Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

  • Advertisements

Archive for the ‘JSF’ Category

All about JSF (Java Server Faces)

Which JSF you like???

Posted by Pankil Patel on July 11, 2011


Posted in JSF | Leave a Comment »

How to solve URL problem in JSF???

Posted by Pankil Patel on September 20, 2010

How to solve URL problem in JSF???

One common URL problem in JSF is that: It is displaying last visited page URL instead of current page URL….

Solution of this problem is: Add <redirect /> tag in all <navigation-case> to make URL proper.

Without it, it will display last URL (one page old) instead of current URL:


<redirect />

Posted in JSF | 4 Comments »

How to integrate JSF with Spring

Posted by Pankil Patel on September 17, 2010

Step 1: Add required jars into your project

Here in this example we required:

  • commons-beanutils.jar
  • commons-collections.jar
  • commons-digester.jar
  • commons-el-1.0.jar
  • jboss-faces.jar
  • jsf-api.jar
  • jsf-impl.jar
  • standard.jar

If want to add richfaces support into your application then add below jar also:

  • richfaces-api-3.2.1.GA.jar
  • richfaces-impl-3.2.1.GA.jar
  • richfaces-ui-3.2.1.GA.jar

Step 2: Edit your web.xml for jsf support

  • Add entry of context-param


  • Add FacesServlet and it’s servlet-mapping in last for their appropriate section.

<servlet-name>Faces Servlet</servlet-name>

<servlet-name>Faces Servlet</servlet-name>

If you are using Richfaces add also below filter and it’s mapping section into web.xml

<display-name>RichFaces Filter</display-name>
<servlet-name>Faces Servlet</servlet-name>

Step 3: Add faces-config.xml, faces-managed-beans.xml and faces-navigation.xml files under WEB-INF folder

For Demo and more detail download


You can use same faces-managed-beans.xml and faces-navigation.xml in this example as per your customization.

Best of luck………………………..

Posted in JSF | 1 Comment »

JavaEE 6 application with JSF2, EJB3 and JPA – Using Netbeans 6.8

Posted by Pankil Patel on April 12, 2010


Posted in JSF | 1 Comment »


Posted by Pankil Patel on February 18, 2010

1) How to get FacesContext from HTTP ServletContext

public static FacesContext getFacesContext(HttpServletRequest request, HttpServletResponse response) {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null) {
// Create new Lifecycle.
LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

// Create new FacesContext.
FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
facesContext = contextFactory.getFacesContext(request.getSession()
.getServletContext(), request, response, lifecycle);

// Create new View.
UIViewRoot view = facesContext.getApplication().getViewHandler().createView(facesContext, “”);

// Set current FacesContext.

return facesContext;

private static abstract class FacesContextWrapper extends FacesContext {
protected static void setCurrentInstance(FacesContext facesContext) {

2) Don’t Use primefaces-2.0 with JSF 1.2 instead of it use primefaces-1.0

Posted in JSF | Leave a Comment »