2013-04-13 105 views
0

得到以下例外访问http://localhost:8081/ReportGeneratorJSF/ com.sun.faces.context.FacesFileNotFoundException时:/login.xhtml不在的ExternalContext实测值作为资源JSF 2.0 FileNotFoundException异常

我使用JSF 2.0

我有创建内部WEB-INF文件夹中的login.xhtml其使用basictemplate.xhtml

// login.xhtml

<ui:composition template="/WEB-INF/template/basictemplate.xhtml"> 
... 
textboxs and submit button 
... 
</ui:composition> 
使用header.xhtml和footer.xhtml的模板

// web.xml中

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> 
    <display-name>ReportGeneratorJSF</display-name> 

    <welcome-file-list> 
     <welcome-file>faces/login.xhtml</welcome-file> 
     </welcome-file-list> 
     <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> 

能否请您为它提供的解决方案。

回答

1

您的文件有问题,你需要将它们像这样:

WEB-INF 
- faces-config.xml 
- web.xml 
login.xhtml 
header.xhtml 
footer.xhtml 
... 
+0

感谢您的帮助,它的工作。我犯了一个愚蠢的错误:( – Soheb

+0

@Sheheb很高兴它的帮助,你可以标记为回答!:) –

相关问题