Java Server Faces (JSF) is a server side user interface component framework for Java technology based web applications.
JSF is a component oriented and event driven framework for web applications.
Create a simple JSF application in Maven
- Create the maven web application via command prompt eg:- SimpleJSF and open it in Net beans.
- Insert the following dependencies to your pom.xml file to include the jsf2.0 libraries
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.0-b13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.0-b13</version>
<scope>compile</scope>
</dependency>
- Create a new JSF file (index.xhtml) in the project. (New---> JSF Page)
- In web.xml include the following tags for servlet mapping and set the welcome page.
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet
</servlet-class>
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml </welcome-file>
</welcome-file-list>
- After that create a managedbean (New-->JSFMAnagedBean-->studentManagedBean)
In JSF 2.0, Java bean that can be accessed from JSF page is called
Managed Bean.
Managed Bean.
The managed bean can be a normal Java bean, which contains the getter
and setter methods,business logic or even a backing bean.
- After that you create the following classes
The Structure of the application is like this:
- If you want to insert the prime faces in your application. You should insert the following dependency and repository
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.2</version>
</dependency>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
Java is a prominent programming language in the current IT industry and the advanced level of Java courses are wanted by most of the professional. Your blog help me to observe some important points in Java language.
ReplyDeleteRegards:
java training in chennai velachery
java training center in chennai