Content
-->jsf Life Cycle
--->Developer point of View
---> step by step Develpement
--->Example program --http://siva2baba.diinoweb.com
JSF Life Cycle
Restore view phase
||
1.User requests a JSF page by clicking a link, button.
2.phase view generation of the page,
binding of components to its event handlers and
validators are performed
3.whole set-up represents a view.
(root UI Component called 'view')
4.view is saved in the FacesContext object.
5.The FacesContext stores the view in
its viewRoot property.
6.All the JSF components are contained by
viewRoot for the current view ID.
7.Component tree of a page is newly built or restored.
Apply request values phase
||
Process validations phase :
||
Update model values phase :
||
Invoke application phase :
||
Render response phase:
Example program --http://siva2baba.diinoweb.com
step by step Develpement
JSF Component Model
jsf-guessnumber
||
||
||
WEB-INF
||----->web.xml
||----->faceconfig.xml
||------>index.jsp
||------>greeting.jsp
||------>response.jsp
||------>welcomeJSF.jsp
||------>classes
||
||----->guessNumber
||
||--->MessageFactory.java
||---->UserNumberBean.java
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<security-constraint>
<!-- This security constraint illustrates how JSP pages
with JavaServer Faces components can be protected from
being accessed without going through the Faces Servlet.
The security constraint ensures that the Faces Servlet will
be used or the pages will not be processed. -->
<display-name>Restrict access to JSP pages</display-name>
<web-resource-collection>
<web-resource-name>
Restrict access to JSP pages
</web-resource-name>
<url-pattern>/greeting.jsp</url-pattern>
<url-pattern>/response.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>
With no roles defined, no access granted
</description>
</auth-constraint>
</security-constraint>
</web-app>
index.jsp
<jsp:forward page="greeting.faces" />
|