Differences between revisions 5 and 6
Revision 5 as of 2009-09-20 23:00:56
Size: 2149
Editor: localhost
Comment: converted to 1.6 markup
Revision 6 as of 2013-04-16 15:03:54
Size: 2204
Comment: formatting
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
 1. Backup everything  A. Backup everything
Line 10: Line 10:
 2. Download and Install facelets  A. Download and Install facelets
Line 13: Line 13:
 3. For each .jsp file:  A. For each .jsp file:
Line 17: Line 17:
  b. insert the xhtml doctype tag at the very top
{{{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
}}}
  a. insert the xhtml doctype tag at the very top
Line 22: Line 19:
  c. add namespaces to the root level xml element
{{{
<f:view>
}}}
becomes
{{{
<f:view
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets">
}}}
    {{{
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    }}}
Line 33: Line 23:
or   a. add namespaces to the root level xml element
 {{{
 <f:view>
 }}}
 becomes
 {{{
 <f:view
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets">
 }}}
Line 35: Line 34:
{{{
<html>
}}}
becomes
{{{
<html
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets">
}}}
 or
Line 45: Line 36:
  d. remove jsp directives, change
{{{
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
}}}
   to
{{{ ...
 {{{
 <html>
 }}}
 becomes
 {{{
 <html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets">
 }}}

  a. remove jsp
directives, change
 {{{
 
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
 }}}
    to
 {{{
Line 54: Line 55:
}}}
after the other xmlns: attributes in 3.c. above
 }}}
 after the other xmlns: attributes in 3.c. above
Line 57: Line 58:
  e. add the xmlns: of any other jsf libs (tomahawk, tobago, htmlib, ...) to the end, after 3.d above   a. add the xmlns: of any other jsf libs (tomahawk, tobago, htmlib, ...) to the end, after C.d above
Line 59: Line 60:
  f. for each jsf lib you add, you must put the corresponding taglib.xml file under .../WEB-INF/   a. for each jsf lib you add, you must put the corresponding taglib.xml file under .../WEB-INF/
Line 61: Line 62:
  g. convert other jsp tags, e.g.
{{{
<% /* my comment */ %>
}}}
becomes
{{{
<!-- my comment -->
}}}
Note that you will probably want to use the following instead of <!-- my comment --> as standard html comments are stripped by default and treated as literal text block components if re-enabled.
{{{
<ui:remove>my comment</ui:remove>
}}}
  a. convert other jsp tags, e.g.
 {{{
 
<% /* my comment */ %>
 }}}
 becomes
 {{{
 
<!-- my comment -->
 }}}
 
Note that you will probably want to use the following instead of <!-- my comment --> as standard html comments are stripped by default and treated as literal text block components if re-enabled.
 {{{
 
<ui:remove>my comment</ui:remove>
 }}}
Line 74: Line 75:
  h. change all xml entities to numerical form, e.g.
{{{
&nbsp;
}}}
becomes
{{{
&#160;
}}}
  a. change all xml entities to numerical form, e.g.
 {{{
 &nbsp;
 }}}
 becomes
 {{{
 &#160;
 }}}

For Tips to use specific Component Libraries see

Converting from JSP to facelets

  1. Backup everything
  2. Download and Install facelets
  3. For each .jsp file:
    1. rename file xxx.jsp to xxx.xhtml
    2. insert the xhtml doctype tag at the very top
      •     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    3. add namespaces to the root level xml element
      •         <f:view>
        becomes
                <f:view
                   xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:ui="http://java.sun.com/jsf/facelets">
        or
                <html>
        becomes
                <html
                   xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:ui="http://java.sun.com/jsf/facelets">
    4. remove jsp directives, change
      •         <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
        • to
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
        after the other xmlns: attributes in 3.c. above
    5. add the xmlns: of any other jsf libs (tomahawk, tobago, htmlib, ...) to the end, after C.d above
    6. for each jsf lib you add, you must put the corresponding taglib.xml file under .../WEB-INF/
    7. convert other jsp tags, e.g.
      •         <% /* my comment */ %>
        becomes
                <!-- my comment -->

        Note that you will probably want to use the following instead of <!-- my comment --> as standard html comments are stripped by default and treated as literal text block components if re-enabled.

                <ui:remove>my comment</ui:remove>
    8. change all xml entities to numerical form, e.g.
      •         &nbsp;
        becomes
                &#160;
    9. change xml special characters in javascript and el expressions, & becomes &, < becomes < j. if you have any other conversion steps, please add them here.

This should get you to the point where your application works as facelets. From there, you can start using the facelets features.

MigrateFromJspToFacelets (last edited 2013-04-16 15:03:54 by PalmerEldritch)