17 September, 2018


Related Blogs



JSF1.X JSF 2.X JSF 1.X version config file is mandatory and annotation is not supports 1.In this JSF config file is optional and in place of config file we are able to use annotations.
1)To represent managed bean metadata, we have to use the following annotations on the top of managed bean class  

  a) Managed bean(name=”---”) Where ”name” member will take logical name of the managed bean class This annotation will be pre presented by a predefined  interfaces javax.faces.bean. managed beam 2)@xxX scoped Eg: @session scoped @Application scoped @page scoped @Request scoped This annotation can be used to represent a particular scope fore the managed bean

  1. ii) In JSF 1.X We are able to use only JSP pages to prepare user interface

In JSF 2.x Version we are able to use both Jsp & xhtml pages to prepare users interface. In case of JSF 1.X version F/W is using explicit navigation system, it must require navigation rules configuration in faces-config.xml file explicitly in order to forward request to target page In case of JSF 2.X Version. f/w has an implicit navigation system it should not require explicit “navigation rules” configuration from faces-config.xml file. It will forward request to  the target pages on the basis of the return value from action method defined in the respective managed bean component.   Note: It the return value from action method is “success” then implicit navigation system will forward request to either success jsp or success. Xhtml file. 4) In case of JSF 1.X version support is available but we have to provide some explicit configuration. In case of JSF 2.x version supported is inbuilt, it shouldn’t require any explicit configuration.

  1. In JSF 1.x Version face lets tag library is not good in JSF 2.X Version, face lets supported cs very good to provide compositions.



<html xmlns= Xmln:f=”” Xmln:h=”” > <f.view> <h:form> <h:panel grid columns=”2”> <h: output text value=”user name”/> <h:input text id=”u name”value=#{user bean. Uname”/} <h:command button value=”say hello” action=#{user bean say hello}”/> </h:panelgrid> </h:form></f:view></html>  


<html xmlns=”http//” Xmln:f=”http//” Xmln:h=”http//”> <f:view> <h1> <h:output text value=”Hello----”/><h:output text value- “#{userBean.u name}”/> </h1> </f:view></html>  


Package com. soft Import javax. faces. bean. managed beans; Import javax. faces. bean. Session scoped; @managed bean(name=”user bean”) @session scoped Public class user Bean{ Private string uname; Public setting getuname(){ Return u name; } Public void set u name(String uname){ This. U name=u name; } Public string say Hello(){ Return ”wish”; } }  


//same as prev.example <web-app> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp. faces servlet</servlet class> <load-on-startup>1</load.on.strtup> < /servlet > <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-patterny*.dss</url-pattern>> </servlet-mapping> </web-app>    

About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .