facebook

exception FacesContext cannot be resolved to a type in JSF

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #253670 Reply

    ouafaa
    Member

    hello,
    i followed JSF Quickstart tutoriel to create a JSF project.

    i did all steps .

    in the UserBean.java

    FacesContext facesContext = FacesContext.getCurrentInstance() is underlined red in the editor.

    i did not import the line import javax.faces.context.FacessContext ,i don’t know if it is necessay.

    thank you in advance for your help.

    when excuting the exemple i got the following error:

    javax.servlet.ServletException: #{UserBean.loginUser}: javax.faces.el.EvaluationException: java.lang.Error: Unresolved compilation problems:
    FacesContext cannot be resolved to a type
    FacesContext cannot be resolved
    FacesMessage cannot be resolved to a type
    FacesMessage cannot be resolved to a type
    FacesContext cannot be resolved

    javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)

    #253707 Reply

    Riyad Kalla
    Member

    Did you add JSF Capabilities to your project? Additionally, did MyEclipse automatically add all the JARs under your WEB-INF/lib directory to your build path? If it didn’t, please add them manually.

    Open your project properties, go to Java Build Path > Libraries, click Add, drill down to WEB-INF/lib and add them all, then hit OK.

    #253724 Reply

    ouafaa
    Member

    hello,
    thank you for your response.
    i already added JSF Capabilities .
    if i go to Java Build Path > Libraries, click Add, i have the message no entries available.
    the structure of the project is like this:
    +src
    +J2EE Lib
    +JRE Lib
    +Jsf-api.jar
    +Jsf-impl.jar
    +Jstl.jar
    +Standard.jar
    -Webroot
    +METAINF
    -WEB-INF
    Lib(empty)
    Faces-config.xml
    Html_basic.tld
    Jsf_code.tld
    Web.xml
    UserLogin.jsp

    thank you in advance

    #253749 Reply

    Riyad Kalla
    Member

    Do you have a quick-fix option for the red underlne in UserBean? Do you have an import at the top of the file for the class?

    #253781 Reply

    ouafaa
    Member

    yes, there was a quick-fix to import the javax.faces.context.
    thank you, now the uesrBean.class is generated.
    but when i try to run the demo i have the following eror:
    “password”: Conversion error occurred.
    even i enter a right or a wrong password.
    thank you in advance

    #253793 Reply

    Riyad Kalla
    Member

    Please download the demo we provide with the guide and work backwards from there to figure out the differences:
    http://myeclipseide.com/enterpriseworkbench/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/jsf/JSFLoginDemo.zip

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: exception FacesContext cannot be resolved to a type in JSF

You must be logged in to post in the forum log in