首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

javax.faces.FacesException: Faces context not found. getResponseWriter will fail

2014-01-26 
请问我在做第一个JSF例子的时候出现这个异常: 严重: Servlet.service() for servlet jsp threw exception j

请问我在做第一个JSF例子的时候出现这个异常:

严重: Servlet.service() for servlet jsp threw exception
javax.faces.FacesException: Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml configuration fileand if you are accessing your jsf-pages through the correct mapping. E.g.: if your FacesServlet is mapped to *.jsf (with the <servlet-mapping> -element), you need to access your pages as 'sample.jsf '. If you tried to access 'sample.jsp ', you 'd get this error-message.

请问是什么回事,我按例子模仿的,几乎是一模一样,望高手指教!



------解决方法--------------------------------------------------------
提示不是告诉你了吗?

应该是访问.jsf而不再是.jsp
后缀不对!
If you tried to access 'sample.jsp ', you 'd get this error-message.
------解决方法--------------------------------------------------------
检查你的web.xml中的
<servlet-mapping>
<servlet-name> Faces Servlet </servlet-name>
<url-pattern> *.jsf </url-pattern>
</servlet-mapping>
设置,如设置成*.jsf则访问页面大致如下:
http://localhost:8080/index.jsf
如为*.faces等则访问
http://localhost:8080/index.faces
不能访问http://localhost:8080/index.jsp

        

热点排行