Jsf 使用OmniFaces ExtensionLessURL时,是否可以阻止重定向/到/欢迎文件
我正在使用JSF 2.2和OmniFaces从我的URL中删除文件扩展名:Jsf 使用OmniFaces ExtensionLessURL时,是否可以阻止重定向/到/欢迎文件,jsf,omnifaces,Jsf,Omnifaces,我正在使用JSF 2.2和OmniFaces从我的URL中删除文件扩展名: www.exmaple.com/appname/login.xhtml->…/appname/login。 现在,当我导航到www.example.com/appname/时,我总是被转发到www.exmaple.com/appname/login。是否可以阻止此重定向,转而从www.example.com/appname/提供login.xhtml My.xhtml文件存储在/WebContent/html/中 my
www.exmaple.com/appname/login.xhtml->…/appname/login
。
现在,当我导航到www.example.com/appname/
时,我总是被转发到www.exmaple.com/appname/login
。是否可以阻止此重定向,转而从www.example.com/appname/
提供login.xhtml
My.xhtml文件存储在/WebContent/html/
中
my web.xml中的相关详细信息:
<welcome-file-list>
<welcome-file>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>
<enabled>true</enabled>
<async-supported>false</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
<param-value>/html/*.xhtml</param-value>
</context-param>
login.xhtml
Facesservlet
javax.faces.webapp.FacesServlet
-1
真的
假的
Facesservlet
*.xhtml
org.omnifaces.FACES\u视图\u扫描\u路径
/html/*.xhtml
来自:
高级配置
有关映射、筛选和转发行为的配置设置,请参阅
从:
欢迎文件
如果在FacesView扫描的
中定义了
,并且使用了
(这是默认值,请参见下文),则需要定义一个无扩展的欢迎文件,以防止对/
的请求被重定向到/[欢迎文件]
。例如,没有此http://example.com
将重定向到说http://example.com/index
例如:
<welcome-file-list>
<welcome-file>index</welcome-file>
</welcome-file-list>
指数
换句话说,编辑您的欢迎文件,使其显示为login
,而不是login.xhtml
与具体问题无关:请注意,您似乎对“欢迎文件”的确切含义有一个普遍的误解,因为您可能在每个文件夹中都有一个
login.xhtml
文件,这有点奇怪。另见