Posts

Showing posts from November, 2009

Internals of JSF

Once jsf project set up properly i.e entries in the web.xml,jsf related jars in lib folder of your web app( setting up jsf project ) we have to create a faces-config.xml to make our set up into a full fledged jsf application. Creating Faces-config.xml :: In the name itself telling us that it contains all the configurations needed for all jsf pages.In fact we don't need to create the file with the same name.We can create it with any name and we have to mention same as a context parameter in the WEB.xml ( setting up jsf project ).Now its the time to jump into the detailed view.   Fallowing are the two main components that we use frequently. 1)Managed Beans It represents a Java bean that will be instantiated dynamically at the run time by JSF container.We can achive inversion of control in JSF. Ex: Class User{ private String name; private String Address; //setters and getters for both properties } Declaration in faces-config.xml   <man

SETTING UP JSF

If you have knowledge on java web applications it is very easy to set up Java server faces application.If you have  normal web application follow the below steps to convert it into a jsf app. An entry in the web application's web.xml to process all the requests by JSF controller servlet called Faces Servlet and a certain URL pattern is specified.              <!-- Faces Servlet -->     <servlet>         <servlet-name>Faces Servlet</servlet-name>         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>         <load-on-startup> 1 </load-on-startup>     </servlet>     <!-- Faces Servlet Mapping -->     <servlet-mapping>         <servlet-name>Faces Servlet</servlet-name>         <url-pattern>*.faces</url-pattern>     </servlet-mapping>       2 . A JSF configuration file faces-config.xml, which allows for configuration of all elements of JSF     application.

Why & What JSF?

There are two technologies popular for developing web applications.They are ASP.net and J2EE.The major advantage of ASP over java is Rapid development style .Of course JAVA has its own advantages like scalability,portability,open source,platform independent etc.Despite of all these advantages java is falling behind because of is Hard-Core coding style. With the introduction of JSF, java brings up Rapid user interface development .We can develop web applications in JSF as fast as ASP can do. Why JSF MVC for web applications Clean separation of roles like (page authors, application developers,component writers,application architects,tool vendors) Easy to use Extendable Component and Rendering architecture Support for client device independence Standard From SUN  Huge vendor and industry support   JSP and Servlet – No built-in UI component model Struts (I am not saying you should not use Struts) – No built-in UI component model – No built-in event model for UI com

ORIGIN OF JSF

Before jsf was introduced there were many frameworks which gained popularity (Spring,Struts etc).All of them offered many benefits explicitly by following MVC2 approach.Despite of those benefits they  lacked something i.e a robust user-interface-oriented framework .We need  better way to handle the view tier. To address this need,several leading software vendors including SUN,IBM,Oracle and BEA met through the Java Community Process in may 2001 and given  detailed specification for building J2EE thin client web applications whose primary goal is to provide a simple way to build user interfaces for java web applications.This result in Java Specification Request JSR #127.Here are the design goals of JSF taken from the java community process. Create a standard GUI component framework which can be leveraged by development tools to make it easier for tool users to both create high quality GUIs and manage the GUI's connections to application behavior. Define a set of