只是 不要
通过http://myserver/myapp/main.jsp打开应用程序,而是通过http://myserver/myapp/faces/main.jsp或(更推荐使用)http://
myserver / myapp / main打开。
jsf。
如果你的整个关注的是,最终用户不应该能够访问JSP页面外
url-pattern的的
FacesServlet(否则这个问题就没有多大意义;)),然后去的
*.jsf模式,并添加
security-constraint一个空
auth-constraint的
*.jsp模式到
web.xml。这应注意,最终用户将无法
*.jsp直接请求URL。
<security-constraint> <display-name>Restrict direct access to JSP files</display-name> <web-resource-collection> <web-resource-name>JSP files</web-resource-name> <url-pattern>*.jsp</url-pattern> </web-resource-collection> <auth-constraint /></security-constraint>
使用
/faces/*映射时,这是不可能直接实现的。我也会摆脱它
web.xml。
此外,覆盖最终用户谁是打字的http:// MYSERVER /
MyApp的,那么就定义
main.jsf为
welcome-file中
web.xml和摆脱对方definied欢迎文件。但是,在Tomcat(可能还有其他servlet容器)中,您将需要创建一个具有正确名称的空文件,以欺骗该文件在磁盘上的服务器。



