我正在尝试设置特定网址的视图页面,但它不起作用,这是一个代码:
漂亮-config.xml中:
<pretty-config>
<url-mapping id="loginPage">
<pattern value="/app"></pattern>
<view-id>/loginPage.xhtml</view-id>
</url-mapping>
</pretty-config>
的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>FiranyCRM</display-name>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
如果我在浏览器中设置了这样的网址:FiranyCRM/loginPage.xhtml
则会加载视图,但是当我将loginPage.xhtml更改为/ app时,它将无效并且浏览器上显示错误“未找到”,控制台位于eclipse没有说什么