Tutorial: Creating JavaServer Faces JSF application in Eclipse

Let us see how to create a simple application using JavaServer Faces or JSF framework in Eclipse IDE. First let us see what are the tools required to create our hello world JSF application.

  1. JDK 1.5 above (download)
  2. Tomcat 5.x above or any other container (Glassfish, JBoss, Websphere, Weblogic etc) (download)
  3. Eclipse 3.2.x above (download)
  4. Sun Reference Implementation of JSF: (download). Following are the list of JAR files required for this application.
    • jsf-impl.jar
    • jsf-api.jar
    • jstl.jar
    • common-logging.jar
    • common-beanutils.jar
    • common-collections.jar
    • common-chain.jar
    • common-digester.jar

We will implement a JSF application with an Add User screen with two fields, ID and User Name. Once user enter these values and press submit, she will be redirected to a welcome page displaying the user name.

Let us start with our first JSF based web application.

Step 1: Create Dynamic Web project

Open Eclipse and goto File -> New -> Project and select Dynamic Web Project in the New Project wizard screen.
dynamic web project eclipse

Select Dynamic Web application and click Next.
create dynamic web project jsf

Write the name of the project HelloWorldJSF. Once this is done, select the target runtime environment (e.g. Apache Tomcat v6.0). This is to run the project inside Eclipse environment. In configuration select JavaServer Faces v1.2 Project and press Next.

jsf-new-project

On Project Facets window, select Java 5 and JSF 1.2 and press Next.

Skip Web module window and press Next.

jsf-capabilities-face-servlet

Select JSF component library. Click New in Component Libraries and add jstl.jar, jsf-api.jar and jsf-impl.jar. In URL Mapping Patterns add /faces/* and then click Finish.

Once the project is created, you can see its structure in Project Explorer.
jsf-project-explorer-view

Step 2: Create Package and Managed bean

Create a package net.viralpatel.jsf.helloworld in the source folder and create a Java file UserBean.java. Copy following content into UserBean.java.

package net.viralpatel.jsf.helloworld;

public class UserBean {
	private int id;
	private String name;
	
	//Action method to add user
	public String addUser() {
		
		return "success";
	}	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}

Above Java class is a User bean that we will use to store our user’s information. This class acts like a form bean and action class. The addUser() method will get called when we click Add button on our Add User page.

Step 3: Create JSP files

Create two JSP files: AddUser.jsp and ListUser.jsp in WebContent folder. Copy following content in each of these files.

AddUser.jsp

<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
	
<html>
<head>
	<title>Add New User Form</title>
</head>
<body>
<f:view>
		<p>
			<h:message id="errors" for="User_ID" style="color:red"/>
		</p>
	<h:form>
		<h:panelGrid border="1" columns="2">
			<h:outputText value="ID"></h:outputText>
			<h:inputText id="User_ID" value="#{userBean.id}" required="true">
				<f:validateLongRange minimum="1" maximum="500"/>
			</h:inputText>
			<h:outputText value="Name"></h:outputText>
			<h:inputText value="#{userBean.name}"></h:inputText>
			<h:commandButton action="#{userBean.addUser}" 
				value="Add Customer"></h:commandButton>
		</h:panelGrid>
	</h:form>
</f:view>
</body>
</html>

We have added a validation rule for ID using f:validateLongRange tag and required=”true” attribute. The ID must be in between 1 and 500.

ListUser.jsp

<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<html>
<head>
	<title>List of Users</title>
</head>
<body>
<f:view>
	<h:form>
		<h:outputText value="User #{userBean.name} is added successfully.">
		</h:outputText>
	</h:form>
</f:view>
</body>
</html>

Step 4: Modify faces-config.xml file

Open faces-config.xml from WebContent -> WEB-INF folder and copy following content into it.

<?xml version="1.0" encoding="UTF-8"?>

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
	version="1.2">
	<managed-bean>
		<managed-bean-name>userBean</managed-bean-name>
		<managed-bean-class>
			net.viralpatel.jsf.helloworld.UserBean
		</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
	</managed-bean>
	<navigation-rule>
		<display-name>AddUser</display-name>
		<from-view-id>/AddUser.jsp</from-view-id>
		<navigation-case>
			<from-outcome>success</from-outcome>
			<to-view-id>/ListUser.jsp</to-view-id>
		</navigation-case>
	</navigation-rule>
</faces-config>

In faces config we have defined a managed bean UserBean with scope session and mapping from AddUser.jsp to ListUser.jsp.

Step 5: Execute and run the project

Final step is to execute the project and view it in browser.
For this, right click on Project Name in Project Explorer -> Run As -> Run on Server (Shortcut Alt+Shift+X, R).

add-new-user-jsf-project-eclipse

Once you enter ID and Username and press Add User, following success screen will appear.

add-user-success-jsf-project-eclipse

Download complete WAR file with source

Download WAR with Source (1.48 MB)

Next >> JavaServer Faces JSF Validation Tutorial: Error Handling in JSF.



88 Comments

  • Sumit 24 August, 2012, 15:42

    HTTP Status 404 – /HelloWorldJSF/
    i am getting this error when i run the application.
    type Status report

    message /HelloWorldJSF/

    description The requested resource (/HelloWorldJSF/) is not available.
    Apache Tomcat/6.0.18

    waiting for your reply

    • Maheshwar Prasad 10 September, 2013, 17:43

      check your Web.xml file like any incorrect syntax capital or small letter of class name or many more in .xml file

    • Anurag Mishra 3 December, 2013, 10:45

      Your HelloWorldJSF application is not working with url http://localhost:8080/HelloWorldJSF/faces/AddUser.jsp on my machine.

      This error is coming on console

      java.lang.ClassNotFoundException – javax.servlet.jsp.jstl.core.Config

  • varsha 3 September, 2012, 22:02

    Hi Viral,

    Is there mapping between web.xml and faces-config.xml file.If i run this app as run on server iam getting an error.But if run using this url iam able to see the o/p.http://localhost:8080/HelloWorldJSF/faces/AddUser.jsp

    • varsha 3 September, 2012, 22:06

      Hi Friends,

      if u add the below line in web.xml,I think u ll see the result

      faces/AddUser.jsp

      • Deepak 13 February, 2013, 19:28

        instead of “faces/AddUser.jsp”

        In web.xml just put this:
        *.jsp

      • vikash 30 May, 2013, 18:00

        Thanks varsha your line of code is useful now I can able to run my Program.

    • Pradeep 7 September, 2013, 15:30

      Hi,

      My index.jsp has,

      <link rel="stylesheet" type="text/css" href="styles/html_tags.css"/>
      <link rel="stylesheet" type="text/css" href="styles/blue_page.css"/>
      <link rel="stylesheet" type="text/css" href="styles/header_footer.css"/>
      <link rel="stylesheet" type="text/css" href="styles/blue_form.css"/>
      
        <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
      

      http://localhost:8092/PMOfinal/faces/index.jsp – works fine in Chrome, Mozilla. But in IE, it is plain – without style. Seems like IE is looking for http://localhost:8092/PMOfinal/faces/styles/blue_page.css

      Can u help me in getting rid of this issue – a common solution to all browser.

  • Nsd 19 September, 2012, 21:28

    Will the below mentioned steps work out for JSF project development in eclipse?

    http://goanswered.com/index.php/196/what-are-the-basic-steps-to-create-jsf-application-in-eclipse

    • Ananth 24 September, 2012, 19:28

      thanks.. it was useful for me

  • bineet 4 November, 2012, 15:49

    do i need to set environmental variables for jdk and jre ???

    • Viral Patel 5 November, 2012, 16:24

      For compilation, you’ll need environment variable set to JDK. So set JAVA_HOME to directory where JDK is installed.

  • puneetha 26 November, 2012, 12:13

    HTTP STATUS –>404 NOT FOUND Error…

    waiting for u r reply….

  • Nadisha 15 January, 2013, 11:55

    Add all the jars in WEB-INF/lib
    jsf-impl.jar
    jsf-api.jar
    jstl.jar
    commons-logging.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-chain.jar
    commons-digester.jar
    commons-codec-1.6.jar

    add then add it to the build path..
    It Works!!!!!!!!!!!!!

    • kamirru 16 May, 2013, 23:34

      Yes, it works, thx:)
      if you add the jars it is not necassary to change anything else

  • renato 25 January, 2013, 4:49

    i don’t know what is the problem, please help…

    24-01-2013 07:15:25 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: La biblioteca nativa de Apache Tomcat basada en ARP que permite un rendimiento óptimo en entornos de desarrollo no ha sido hallada en java.library.path: /usr/lib/jvm/java-6-oracle/jre/lib/amd64/server:/usr/lib/jvm/java-6-oracle/jre/lib/amd64:/usr/lib/jvm/java-6-oracle/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
    24-01-2013 07:15:25 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    ADVERTENCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:HelloWorldJSF’ did not find a matching property.
    24-01-2013 07:15:25 PM org.apache.coyote.http11.Http11Protocol init
    INFO: Inicializando Coyote HTTP/1.1 en puerto http-8081
    24-01-2013 07:15:25 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 418 ms
    24-01-2013 07:15:25 PM org.apache.catalina.core.StandardService start
    INFO: Arrancando servicio Catalina
    24-01-2013 07:15:25 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
    24-01-2013 07:15:25 PM org.apache.catalina.core.StandardContext addApplicationListener
    INFO: El escuchador “org.apache.myfaces.webapp.StartupServletContextListener” ya está configurado para este contexto. La definición duplicada ha sido ignorada.
    24-01-2013 07:15:25 PM org.apache.myfaces.webapp.StartupServletContextListener dispatchInitializationEvent
    INFO: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON’ found, using default value false
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS’ found, using default value false
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE’ found, using default value false
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS’ found, using default value true
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.RENDER_VIEWSTATE_ID’ found, using default value true
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.STRICT_XHTML_LINKS’ found, using default value true
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getLongInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.CONFIG_REFRESH_PERIOD’ found, using default value 2
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
    INFO: No context init parameter ‘org.apache.myfaces.VIEWSTATE_JAVASCRIPT’ found, using default value false
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig createAndInitializeMyFacesConfig
    INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig createAndInitializeMyFacesConfig
    INFO: Starting up Tomahawk on the RI-JSF-Implementation.
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig createAndInitializeMyFacesConfig
    INFO: Starting up Tomahawk on the MyFaces-JSF-Implementation
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.config.MyfacesConfig createAndInitializeMyFacesConfig
    GRAVE: Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator feedStandardConfig
    INFO: Reading standard config META-INF/standard-faces-config.xml
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator feedWebAppConfig
    INFO: Reading config /WEB-INF/faces-config.xml
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: Starting up MyFaces-package : myfaces-api in version : 1.2.9 from path : file:/home/renato/workspaceInfo/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldJSF/WEB-INF/lib/myfaces-api-1.2.9.jar
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: Starting up MyFaces-package : myfaces-impl in version : 1.2.9 from path : file:/home/renato/workspaceInfo/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldJSF/WEB-INF/lib/myfaces-impl-1.2.9.jar
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : tomahawk not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : tomahawk12 not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : tomahawk-sandbox not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : tomahawk-sandbox12 not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : tomahawk-sandbox15 not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : myfaces-orchestra-core not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : myfaces-orchestra-core12 not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : trinidad-api not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : trinidad-impl not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : tobago not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : commons-el not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.config.FacesConfigurator startLib
    INFO: MyFaces-package : jsp-api not found.
    24-01-2013 07:15:25 PM org.apache.myfaces.shared_impl.util.LocaleUtils toLocale
    ADVERTENCIA: Locale name in faces-config.xml null or empty, setting locale to default locale : es_BO
    24-01-2013 07:15:26 PM org.apache.myfaces.config.FacesConfigurator handleSerialFactory
    INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
    24-01-2013 07:15:26 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
    INFO: ServletContext ‘/home/renato/workspaceInfo/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldJSF/’ initialized.
    24-01-2013 07:15:26 PM org.apache.myfaces.webapp.StartupServletContextListener dispatchInitializationEvent
    INFO: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
    24-01-2013 07:15:26 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Inicializando Mojarra 2.0.1 (FCS b02) para el contexto ‘/HelloWorldJSF’
    24-01-2013 07:15:26 PM com.sun.faces.config.ConfigManager initialize
    INFO: Unsanitized stacktrace from failed start…
    java.lang.UnsupportedOperationException
    at javax.faces.application.Application.getResourceHandler(Application.java:286)
    at com.sun.faces.config.processor.ApplicationConfigProcessor.setResourceHandler(ApplicationConfigProcessor.java:751)
    at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:309)
    at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:113)
    at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:115)
    at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:113)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:222)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:335)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:219)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    24-01-2013 07:15:26 PM org.apache.catalina.core.StandardContext listenerStart
    GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase com.sun.faces.config.ConfigureListener
    com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:354)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:219)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.lang.UnsupportedOperationException
    at javax.faces.application.Application.getResourceHandler(Application.java:286)
    at com.sun.faces.config.processor.ApplicationConfigProcessor.setResourceHandler(ApplicationConfigProcessor.java:751)
    at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:309)
    at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:113)
    at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:115)
    at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:113)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:222)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:335)
    … 16 more
    24-01-2013 07:15:26 PM org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    24-01-2013 07:15:26 PM org.apache.catalina.core.StandardContext start
    GRAVE: Falló en arranque del Contexto [/HelloWorldJSF] debido a errores previos
    24-01-2013 07:15:26 PM com.sun.faces.config.ConfigureListener contextDestroyed
    GRAVE: Unexpected exception when attempting to tear down the Mojarra runtime
    java.lang.IllegalStateException: La aplicación no se ha inicializado correctamente durante el inicio, no se encuentra la fábrica: javax.faces.application.ApplicationFactory
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306)
    at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:104)
    at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:305)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4011)
    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4615)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4512)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    24-01-2013 07:15:26 PM org.apache.myfaces.webapp.StartupServletContextListener dispatchInitializationEvent
    INFO: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
    24-01-2013 07:15:26 PM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
    INFO: No ExternalContext using fallback LifecycleProvider.
    24-01-2013 07:15:26 PM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
    INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider
    24-01-2013 07:15:26 PM org.apache.myfaces.webapp.StartupServletContextListener dispatchInitializationEvent
    INFO: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
    24-01-2013 07:15:26 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    GRAVE: A web application created a ThreadLocal with key of type (value ) and a value of type [org.apache.myfaces.config.RuntimeConfig] (value [org.apache.myfaces.config.RuntimeConfig@60d3ade7]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.

  • Thomas Mann 28 January, 2013, 4:46

    Well yeah!
    Thats what I hate about Java.
    You want s.th. to work and you have to sew your own patchwork together.
    A library here, a library there…….
    sucks and I have to learn it for the job…. why didn’t oracle just kill java…..

    • Brian 22 April, 2014, 8:03

      Wow, truly an idiotic statement. Perhaps you should look for another job within your skill set. Whatever that is.

  • sreenath 7 February, 2013, 20:58

    Hi I have all jar files in my lib folder but still i am getting

    SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
    java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4733)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

  • yash 5 April, 2013, 12:47

    java.util.MissingResourceException: Can’t find bundle for base name javax.faces.Messages, locale en_US

    Hi,
    I am getting this error on running this code on server

  • Jagan Patel 8 May, 2013, 17:24

    This given me a lot of happies, I did a small mistake, by the help of your site I resolved it.

  • Ijaj Momin 14 May, 2013, 10:56

    *****************************************************Thank you.**********************************
    Succesfulli executed ………***********************
    I got good tutorial…..

  • Fareed Mohammed 27 May, 2013, 17:34

    excellent example !…keep posting thanks

  • Anil 6 June, 2013, 21:34

    Can anybody explain me the flow step by step?

  • Siddaram 30 June, 2013, 11:40

    Hello VP,

    I have googled on the following error and found that i need to remove previous old version jstl tags or remove from lib folder. i have tried out options found on net.., but still unable to solve..,
    Please help to resolve the exception..!!

    Have gone thru these links
    http://www.coderanch.com/t/213759/JSF/java/Error-JSF-custom-tag
    and
    https://community.jboss.org/thread/221863?start=15&tstart=0

    https://forums.oracle.com/thread/1721061

    org.apache.jasper.JasperException: Unable to convert string "User  is added successfully." to class "javax.el.ValueExpression" for attribute "value": Property Editor not registered with the PropertyEditorManager
    	at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:873)
    	at org.apache.jsp.listUser_jsp._jspx_meth_h_005foutputText_005f0(listUser_jsp.java:193)
    	at org.apache.jsp.listUser_jsp._jspx_meth_h_005fform_005f0(listUser_jsp.java:161)
    	at org.apache.jsp.listUser_jsp._jspx_meth_f_005fview_005f0(listUser_jsp.java:119)
    
  • Siddaram 30 June, 2013, 11:48

    Also i have mojarra-2.1.6-FCS user library installed

  • mahesh 24 July, 2013, 16:49

    Servlet.service() for servlet [jsp] in context with path [/HelloWorldJSF] threw exception with root cause
    java.lang.RuntimeException: Cannot find FacesContext

  • A Kumar 19 November, 2013, 3:57

    I am getting these following errors:

    from the WAR file downloaded from your site:
    Nov 18, 2013 5:23:23 PM com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent
    WARNING: Unable to find component with ID ‘User_ID’ in view.

    from my own helloworld program:
    Nov 18, 2013 5:26:20 PM org.apache.myfaces.shared_impl.renderkit.html.HtmlMessageRendererBase renderMessage
    SEVERE: Could not render Message. Unable to find component ‘User_ID’ (calling findComponent on component ‘errors’). If the provided id was correct, wrap the message and its component into an h:panelGroup or h:panelGrid.
    Nov 18, 2013 5:26:20 PM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
    INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider
    Nov 18, 2013 5:26:20 PM org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider newInstance
    INFO: Creating instance of net.viralpatel.jsf.helloworld.UserBean
    Nov 18, 2013 5:26:20 PM org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase renderChildren
    WARNING: PanelGrid j_id_jsp_1918625525_2:j_id_jsp_1918625525_3 has not enough children. Child count should be a multiple of the columns attribute.

    Please help.

    Thanks.

  • parimala 6 March, 2014, 9:12

    HTTP Status 404 – /HelloWorldJSF/

    ——————————————————————————–

    type Status report

    message /HelloWorldJSF/

    description The requested resource (/HelloWorldJSF/) is not available.

    Hi Viral,

    Please respond to this error.Many people asked about this.But you were not responding..

  • bavya 26 March, 2014, 15:34

    In faces-config.xml file i am getting the error as
    cvc-complex-type.2.4.b: The content of element ‘managed-bean’ is not complete. One of ‘{http://java.sun.com/xml/ns.javaee”:managed-bean-class}’ is expected

    What does this mean and how can i rectify this……(:

  • J Jagadeesh 23 April, 2014, 12:43

    Hello Sir,
    iam getting the error like

    how to solve [org.apache.myfaces.shared_impl.config.MyfacesConfig] Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations. in eclipse

    please help me

  • mohammed 11 June, 2014, 1:25

    Hi i know the basic of java
    and i dont know what is the next step
    can i learn jsf now ?

  • devender 11 June, 2014, 11:26

    Thanks for greate tutorial .

  • devender kumar 20 June, 2014, 17:43

    Nice tutorial .Thanks for these tutorial .Keep it up with some more tutorial like it.

  • Ramana 18 July, 2014, 19:37

    It is very very simple and sample program

Leave a Reply

Your email address will not be published. Required fields are marked *

Note

To post source code in comment, use [code language] [/code] tag, for example:

  • [code java] Java source code here [/code]
  • [code html] HTML here [/code]

Current ye@r *