我正在使用 JSF 2.0 构建网站。Eclipse 生成了以下 web.xml 文件
...
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
...
所以要查看我的应用程序,我必须访问“localhost/myApp/ faces / index.xhtml”。我宁愿通过访问“localhost/myApp/index.xhtml”直接查看它
我看到了两种选择:
将 web.xml 更改为以下内容
...
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
...
或者在我的基本目录中设置一个 index.xhtml,它直接对 faces/index.xhtml 执行 javascript/meta。
你认为哪个更好 ?还是有另一种方法可以做到这一点?