aspose file tools
The moose likes JSF and the fly likes Cannot find FacesContext and showing the html code in the jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Cannot find FacesContext and showing the html code in the jsp" Watch "Cannot find FacesContext and showing the html code in the jsp" New topic
Author

Cannot find FacesContext and showing the html code in the jsp

Kaushik Baral
Greenhorn

Joined: Aug 08, 2009
Posts: 18
hi,
i was trying some jsf examples and i am getting this error "Cannot find FacesContext" and when im mapping my "faces-config.xml" and "web.xml" like this i can see the html and other code on the jsp page. web.xml and faces-config.xml is given below

web.xml

<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<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>
</web-app>

faces-config.xml

<faces-config>
<navigation-rule>
<from-view-id> /login.jsf</from-view-id>

<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/home.jsf</to-view-id>
</navigation-case>

<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/login.jsf</to-view-id>
</navigation-case>
</navigation-rule>

<managed-bean>
<managed-bean-name>UserBean</managed-bean-name>
<managed-bean-class>com.tm.UserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

</faces-config>

i have changed my jsp files extension to jsf (home.jsf and login.jsf). is this required or extension home.jsp is fine?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56212
    
  13

Please be sure to ask JSF questions in the JSF forum. I have moved this post there for you.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Cannot find FacesContext and showing the html code in the jsp
 
Similar Threads
cant deploy my application,please help
Getting Cannot find FacesContext and sometime showing html codes in the page
Error while accessing hibernate session through JSF
newbie null reference exception
JSF property file's value is not executing