我想将我的JSF 2.0 xhtml文件放在WEB-INF jsf下。 那我该如何访问它们?
你不能。
/WEB-INF无法直接访问文件夹中的文件。
有两种方法可以解决JSF源文件可公共访问的问题。
在地图
FacesServlet
上*.xhtml
,而不是*.jsf
。或者,
*.xhtml
通过<security-constraint>
in 限制直接访问web.xml
。<security-constraint><display-name>Restrict direct access to XHTML files</display-name><web-resource-collection> <web-resource-name>XHTML files</web-resource-name> <url-pattern>*.xhtml</url-pattern></web-resource-collection><auth-constraint />



