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. [ad#blogs_content_inbetween] 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; } }
Code language: Java (java)
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

[ad#blogs_content_inbetween]
<%@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>
Code language: HTML, XML (xml)
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>
Code language: HTML, XML (xml)

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>
Code language: HTML, XML (xml)
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). [ad#blogs_content_inbetween] 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.
Get our Articles via Email. Enter your email address.

You may also like...

91 Comments

  1. Jide B says:

    Very simple and ease to follow.

    Many thanks

  2. Thanks for the comment Jide. :)

  3. Navier says:

    The last screen shot of the browser still has AddUser.jsp as the URL instead of ListUser.jsp. This creates confusion.

  4. Hi Navier,
    JSF uses internal FORWARD instead of REDIRECT to navigate to the success page. Hence the URL will not get changed.

  5. Eduard Korenschi says:

    Well, it uses forward “by default”. Just add a “redirect” tag to your navigation handler in faces-config.xml and there you are …. No more confusion (but you loose requestMap parameters, in case you use them or FacesMessages).

    Eduard

  6. nishant says:

    Very good example Viral.. helped me to understand jsf..

  7. Thanks for the comment Nishant. You may want to subscribe your email for the Articles.

  8. Raghavendra says:

    This helped me for executing my first JSF program. Thanks for your work.

  9. Dipendra says:

    hiiii viral great example .. i understood well bt wanna know more abt jsf..
    could u jst forward me one simple application using jsf ..
    Thanks

  10. Rajan says:

    Hi Viral.. Great example for the beginners.

    Thanks,

    Rajan

  11. Brajesh says:

    hi dude, its nice example….. really impressive…..

  12. Me says:

    Thanks, this article is very useful.

  13. Sharon Moniz says:

    Hi Viral,

    What is better, jsf RI or Apache’s myfaces?
    You have used jsf api nad impl jars
    Is it better than myfaces api and impl jars?
    what are the advantages and disadvantages?
    :)

  14. Hi Sharon,
    JSF is a specification provided by SUN and you will find a number of implementations of JSF and one of such implementation is from Apache called MyFaces. Although in above example I have used JSF just to show a basic example, it may be useful to use MyFaces in your early stage of development. MyFaces provides lots of components that can be easily integrated with application.

    If you are learning JSF for first time and just wants to know the life cycle of JSF application, then the reference implementation is quite useful. But if you are developing a full fledged application then you must use MyFaces.

    Hope this answers you queries. :)

  15. Sharon Moniz says:

    thank you so much :)

  16. Viv says:

    Hi,

    I keep getting this warning on the JSP code, “userBean can not be resolved”. Can someone please tell me what I am doing wrong. The error log says

    rg.apache.catalina.loader.StandardClassLoader@601bb1
    javax.faces.webapp.FacesServlet
    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /LibraryWebTest threw load() exception
    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.ApplicationContext log
    INFO: Marking servlet Faces Servlet as unavailable
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.ApplicationContext log
    SEVERE: Error loading WebappClassLoader
    delegate: false
    repositories:
    /WEB-INF/classes/
    ———-> Parent Classloader:
    org.apache.catalina.loader.StandardClassLoader@601bb1
    javax.faces.webapp.FacesServlet
    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /JSFTest threw load() exception
    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.ApplicationContext log
    INFO: Marking servlet Faces Servlet as unavailable
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.ApplicationContext log
    SEVERE: Error loading WebappClassLoader
    delegate: false
    repositories:
    /WEB-INF/classes/
    ———-> Parent Classloader:
    org.apache.catalina.loader.StandardClassLoader@601bb1
    javax.faces.webapp.FacesServlet
    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 10, 2009 4:26:40 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /HelloWorldJSF threw load() exception
    java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 10, 2009 4:26:40 PM org.apache.coyote.http11.Http11Protocol start

    Thanks

  17. karuna says:

    Hi Viral.

    This is karuna from ULM..Hope you remember me!.i have to build a small application in JSF. I just went through your tutorial.I did not know that you have good knowledege in JSF too.Good job..probably you can help me out in building the small application in JSF. Will discuss with u my requirements soon!!!

    thanks

    • Hi karuna, Nice to hear from you. Let me know if you need my help in JSF.

      • Sumit says:

        hello viral
        same problem i am having when i run the application

        HTTP Status 404 – /HelloWorldJSF/

        type Status report

        message /HelloWorldJSF/

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

        Reply Me plz…. as soon as possible

  18. Neo says:

    Hi Viral,

    While running your example, I am also getting the same error as Viv… You have any clue what the issue could be?

    Thanks in advance. :)

  19. Patrick says:

    Hi Neo

    The reason you keep getting the error as Viv is that the app cant find the class ‘ javax.faces.webapp.FacesServlet’. In another word it cant find the class javax.faces.webapp.FacesServlet within the jar file jsf-api.jar. What you can try is to go into the JSF Capacities window to make sure you setup the Libraries to include the jsf-api.jar.
    Hope it helps.

  20. Amit Saxena says:

    Hey Viral,
    Great job man.
    Can you help me with a tutorial that combines JPA and JSF capabilities, or rather if you can help me with JPA tutorial , it will be great..

  21. Paul says:

    great for tutorial, I am from Peru, and read this, for me excellent the kind of explanation

  22. satish says:

    When i run your application from eclipse ganemade version i am getting following error.

    INFO: JSF1027: [HelloWorldJSF] The ELResolvers for JSF were not registered with the JSP container.
    2010-04-01 12:01:03.606 NOTIFICATION J2EE JSP-0008 Unable to dispatch JSP Page : Exception:oracle.jsp.parse.JspParseException: /AddUser.jsp: Line # 9,
    Error: Unable to instantiate tag: f:view (class: null) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.
    2010-04-01 12:04:45.529 NOTIFICATION J2EE JSP-0008 Unable to dispatch JSP Page : Exception:oracle.jsp.parse.JspParseException: /AddUser.jsp: Line # 9,
    Error: Unable to instantiate tag: f:view (class: null) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.

    please help me

  23. vinay says:

    nice contents.
    thank you.

  24. Nice quick start guide…I’ve always used Spring MVC and new to JSF now..Do you have an example on how to integrate Facelets with this?

  25. Abhijeet says:

    it is so simple and very easy for me to understand the jsf now
    Thanks

  26. Maneesh says:

    hiiiiii,
    dear thanks for a marvelous guidelines,,,,,,,,,,

  27. Maneesh says:

    You have any clue what the issue could be?

    Thanks in advance. :)

  28. rajesh says:

    hiiiiiiiii
    dear thanks …its very simple and easy to understand …am new to jsf i have one doubt
    in some examples i saw some jsp file and jspx files …why they are used jspx file ? when we have to use jspx?
    thanks in advance…..

  29. rajesh says:

    and one more doubt viral. is it possible to combine tiles with jsf

  30. nandha63 says:

    works fine dude.

  31. IT !!!!!!!!!!!!!!!!!! NICE TUTORIAL FOR BEGINNERS!!!!!!!!!!!!!!!!!

  32. Dhaval says:

    hi
    i create app by ur tuto..
    bt wn i run i getting error
    like Facescontext not find..
    so give me the solution…
    i add this code in web.xml bt i cant run again

    com.sun.faces.config.ConfigureListener

    so give me the solution..

  33. anil says:

    Very good tutorial . Keep on posting this kind of tutorials .
    Helped me a lot . Thanks Viral Patel

  34. nayan says:

    thanks viral
    nice post for newbies

    thanks so much

  35. Iftikhar Ahmed says:

    Simpel and an excellent example for a starter like myself. Apprecaite your work Mr. Patel.
    Iftikhar

  36. Ahmed Abd El-Rasoul says:

    thanks for ever viral ,Very good tutorial

  37. Kamal says:

    Hi,
    when I run your example I got this error :

    org.apache.jasper.JasperException: An exception occurred processing JSP page /AddUser.jsp at line 9

    6: Add New User Form
    7:
    8:
    9:
    10:
    11:
    12:

    can you please help me

  38. puneet shukla says:

    I am getting the error at

    and while running its saying that

  39. Neeraj says:

    Hi Viral,

    Thanks for such a good sample JSF application..
    I followed all the steps provided by you but still getting some error.
    When I hit the below URL, I can see jsp in browser..
    http://localhost:8080/MyJsfProject/faces/AddUser.jsp

    But when I run the project by run –> run on server, it throws the following exception..I have put all required jars in lib folder of my project..
    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: An exception occurred processing JSP page /AddUser.jsp at line 9

    6: Add New User Form
    7:
    8:
    9:
    10:
    11:
    12:

    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause

    javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find FacesContext
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
    org.apache.jsp.AddUser_jsp._jspService(AddUser_jsp.java:99)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

    Please guide…

    Thanks in advance,
    Neeraj

  40. rahul bhawsar says:

    Thank you very much it helped a lot.

  41. bala says:

    HTTP Status 404 – /HelloWorldJSF/

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

    type Status report

    message /HelloWorldJSF/

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

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

    Apache Tomcat/7.0.26

    i am getting this error when i run this program pls help me !!! and pls help me to understand the concept !!! pls reply as soon as possible!!! waiting for ur reply

    • dol says:

      i get the same error. any luck? did u get any answer?

  42. vanita says:

    Nice info…..:)

  43. Kiran says:

    Hi Viral,I am unable the run the above example.I am not sure where to store addUser.jsp and listUser.jsp.I tried creating /faces folder under Web content and tried running the addUser.jsp but i got the error “user can not be found /addUser.jsp. I am using Rational Application Developer v 7.
    Please help me out.

    Kiran

  44. askkuber says:

    hi
    Please check I am not able to download war file
    thanks

  45. JULIAN says:

    Great Tutorial !

  46. Rino says:

    Where should I place the 4 common jars?????

  47. jmt says:

    hi
    I’ve a question when create jsp file , there are many choices
    when i select first one:JSP with html markup and default view setup
    it is work good but when i select 2nd or 3rd choice
    it is run but the text only appear and any jsf component not display
    and if i used EL error will occur

    can you explain me why and what is the difference between choices?

  48. moe says:

    in the userlist.jsp –
    how would i display a list of real users? I know the example is setup to add a single user, but if i changed the bean to a collection for storage.

  49. This example is very easy to understand.Thanks :)

  50. vivek says:

    hello,
    i am not able to run the application and getting the error..

    HTTP Status 404 – /HelloWorldJSF/

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

    type Status report

    message /HelloWorldJSF/

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

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

    Apache Tomcat/7.0.26

    waiting for your reply.

  51. Sumit says:

    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

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

    • Anurag Mishra says:

      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

  52. varsha says:

    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 says:

      Hi Friends,

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

      faces/AddUser.jsp

      • Deepak says:

        instead of “faces/AddUser.jsp”

        In web.xml just put this:
        *.jsp

      • vikash says:

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

    • Pradeep says:

      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.

  53. Nsd says:

    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 says:

      thanks.. it was useful for me

  54. bineet says:

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

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

  55. puneetha says:

    HTTP STATUS –>404 NOT FOUND Error…

    waiting for u r reply….

  56. Nadisha says:

    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 says:

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

  57. renato says:

    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 [java language=”.lang.ThreadLocal”][/java] (value [java language=”.lang.ThreadLocal@ee31e33″][/java]) 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.

  58. Thomas Mann says:

    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 says:

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

  59. sreenath says:

    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)

  60. yash says:

    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

  61. Jagan Patel says:

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

  62. Ijaj Momin says:

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

  63. Fareed Mohammed says:

    excellent example !…keep posting thanks

  64. Anil says:

    Can anybody explain me the flow step by step?

  65. Siddaram says:

    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)
    

  66. Siddaram says:

    Also i have mojarra-2.1.6-FCS user library installed

  67. mahesh says:

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

  68. A Kumar says:

    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.

  69. parimala says:

    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..

  70. bavya says:

    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……(:

  71. 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

  72. mohammed says:

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

  73. devender says:

    Thanks for greate tutorial .

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

  75. Ramana says:

    It is very very simple and sample program

  76. Divyesh says:

    Great work..Thanks Viral

  77. sakthi says:

    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..

  78. Vineet says:

    Thank you Viral for such a great tutorial.

Leave a Reply

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