Date 2010/09/05 JSF Discussion -- some points
Life cycle of a JSF web application starts when user makes a request.
On submission of a page various further tasks are performed like
- validation of data provided in components in the view (JSP Page),
- data conversion according to types specified on server side and much more.
Series of steps that an application follows is called life cycle.
A JSF Application is initiated by calling the Faces Servlet (configured in the web.xml file of a web application),
these activities taking place will come under the category of JSF Request Processing Life-cycle Phases namely,
Restore View
- The restore view phase starts upon user requests to a JSF page by clicking a link, button etc.
- In this phase following things are done namely,
a. view generation of the page
b. binding of components to its event handlers and validators are performed
c. view is saved in the FacesContext object.
Apply Request Values
- The purpose of this phase is for each component to retrieve its current state.
- After restoring of component tree in restore view phase each component in the
tree retrieves its new value and store it locally.
- Component values are typically retrieved from the request parameters.
- If immediate attribute of a component is set to true, then the validation, conversion,
and events associated with the component is processed in this phase.
Process Validations
- Here local values stored for the component in the tree are compared to the validation rules registered for the
components.
- If local value is invalid, an error message is added to FacesContext, and the component is
treated invalid and then JSF proceeds to the render response phase and display the current view showing the
validation error messages.
- If there were conversion errors from the apply request values phase, the messages for these
errors are also displayed.
- If there are no validation errors, JSF proceeds ahead to the update model values phase.
Update Model Values
- After confirming that data is valid in the previous phase local values of components can be set
to corresponding server side object properties i.e. backing beans.
- The bean properties will be updated .
If the local data cannot be converted to the types specified by the bean properties, the life cycle proceeds
directly to the render response phase and errors are displayed if any during applying to the bean.
Invoke Application
- Before this phase the component values have been converted, validated, and applied to the bean objects.
- These can now be used to execute the application's business logic.
- Application-level code is executed such as submitting a form or linking to another page.
- For example user moves to the next page you will have to create a mapping in the faces config.xml file.
- Once this navigation occurs, you move to the final phase of the lifecycle.
Render Response
- In this phase JSP container renders the page back to the user,if jsp is used by application
i.e. view is displayed with all of its components in their current state.
- If this is an initial request, the components will be added to the component tree.
- If this is not an initial request, the components are not added because they are already added to the tree.
- The state of the response is saved after rendering of the content of the view.
- The subsequent requests can access it and it is available to the restore view phase.
Date 2010/09/14 Software Marketplace
A marketplace is a very good concept where in you could actually allow various vendors and customers to interact.
This concept can be implemented in a community system managed via enterprise software where in you allow various vendors for services and customers to buy these services.
The enterprise system hosting this facility would ideally gain out of each transaction at the end.
.jpg)
No comments:
Post a Comment