New Features in JSF2.0
JSF2.0 has introduced many new features in align with its design goals. Few of the major new features are listed below.
1. Avoid entries to Faces-Config.xml with annotations. There are new annotations added in JSF2 for declaring managed beans, scopes for managed bean. Few annotations are listed below
4. Creating a custom component is made much easier in JSF2.0 compared to its earlier version and JSF2 brings in an enhanced resource handling
5. JSF has support to Groovy and hence all the managed bean, validators, converters, renderers shall be a based on groovy
6. Default Navigation mappings using the result of the action method. The page navigation shall be defaulted using the result of the action method. In the below piece of action method, the next page is defaulted to welcome.xhtml. By this way the navigation configuration in the Faces xml shall be avoided
/* * on the call of this action method, the user name is placed in the flash scope
* and redirected to the new page.
* @return welcome page string
*/
public String save() {
Flash flash=FacesContext.getCurrentInstance().getExternalContext().getFlash();
flash.put("name",this.name);
return "welcome";
}
7. Ajax is enabled in JSF2.0 architecture and thus it is not necessary to depend on third party API for ajax features. Ajax shall be used using the f:ajax tag.
<h:commandButton action="#{testBean.save}" value="submit">
<f:ajax execute="@form" render="@displayPanel" event="click"/>
</h:commandButton>
1. Avoid entries to Faces-Config.xml with annotations. There are new annotations added in JSF2 for declaring managed beans, scopes for managed bean. Few annotations are listed below
- @javax.faces.bean.ManagedBean
- @javax.faces.bean.RequestScoped
- @javax.faces.bean.SessionScoped
- @javax.faces.bean.ApplicationScoped
- @javax.faces.bean.ViewScoped
- @javax.faces.bean.NoneScoped
- @javax.faces.validator.FacesValidator
- @javax.faces.convert.FacesConverter
@ManagedBean
@RequestScoped
public class TestBean {--------
--------------------------------------
3. Facelets are the default view technology for the JSF from JSF2.0 and JSP view technology for JSF is deprecated from JSF2.0. Facelets provides a powerful Templating for the application
3. Facelets are the default view technology for the JSF from JSF2.0 and JSP view technology for JSF is deprecated from JSF2.0. Facelets provides a powerful Templating for the application
5. JSF has support to Groovy and hence all the managed bean, validators, converters, renderers shall be a based on groovy
6. Default Navigation mappings using the result of the action method. The page navigation shall be defaulted using the result of the action method. In the below piece of action method, the next page is defaulted to welcome.xhtml. By this way the navigation configuration in the Faces xml shall be avoided
/* * on the call of this action method, the user name is placed in the flash scope
* and redirected to the new page.
* @return welcome page string
*/
public String save() {
Flash flash=FacesContext.getCurrentInstance().getExternalContext().getFlash();
flash.put("name",this.name);
return "welcome";
}
7. Ajax is enabled in JSF2.0 architecture and thus it is not necessary to depend on third party API for ajax features. Ajax shall be used using the f:ajax tag.
<h:commandButton action="#{testBean.save}" value="submit">
<f:ajax execute="@form" render="@displayPanel" event="click"/>
</h:commandButton>
8. Creating a custom component is made much easier in JSF2.0 compared to its earlier version and JSF2 brings in an enhanced resource handling.
9. JSF has support to Groovy and hence all the managed bean, validators, converters, renderers shall be a based on groovy
No comments:
Post a Comment