Facelets step by step

Facelets step by step:
1. Need 3 JAR files in WEB-INF/lib
§ jsf-facelets.jar, el-api.jar, el-ri.jar
 
 
2.In web.mxl
 Extension of faceletsfiles.
E.g., foo.xhtmlwill be accessed as foo.faces.
<web-app></web-app>
<context-param></context-param>
<param-name></param-name> javax.faces.DEFAULT_SUFFIX
<param-value></param-value> .xhtml
How often to check for changes
after initial deployment.
<context-param></context-param>
<param-name></param-name> facelets.REFRESH_PERIOD
<param-value></param-value> 2
Use debug/development output.
<context-param></context-param>
<param-name></param-name> facelets.DEVELOPMENT
<param-value></param-value> true
...
 
 
3. faces-config.xml Setting
<faces-config></faces-config>
<application></application>
<view-handler></view-handler>
com.sun.facelets.FaceletViewHandler
   
...
 
 
4. ? Define template file
¡§ Common data for all pages goes directly in template file
¡§ Sections that will be changed marked with ui:insert
...

 

Content shared by all clients
...
? Define client file(s)
¡§ Specify template file with ui:composition
¡§ Give content for the sections with ui:define
Content to go in "body" section of template
 
 
5. Use xhtml
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
...

你可能感兴趣的:(UI,Web,XHTML,JSF,sun)