问题描述
在WAS服务器上部署应用程序时如何设置URL?除了我要设置的上下文路径之外,URL中还有一个/faces/
.我不知道这是从哪里来的.
How is the URL set when an application is deployed on WAS server? Other than the context path I am setting, I am getting a /faces/
in the URL. I have no clue from where this is coming from.
推荐答案
/faces/
可识别为JSF 1.0/1.1样式的URL模式,其中FacesServlet
通常默认情况下是基于IDE生成的项目configuratoin映射的.后来没有被开发者编辑.您可以在web.xml
中看到以下内容:
The /faces/
is recognizable as JSF 1.0/1.1-style URL pattern where FacesServlet
is often by default mapped on based on IDE-generated project configuratoin which weren't edited afterwards by the developer. You can see this in web.xml
as something like this:
<servlet-mapping>
<servlet-name>Faces Servlet<servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
也许例如还有<welcome-file>
faces/index.xhtml
左右.
Perhaps there's also a <welcome-file>
on e.g. faces/index.xhtml
or so.
要摆脱它,只需将其替换为*.xhtml
.
In order to get rid of it, just replace it by *.xhtml
.
<servlet-mapping>
<servlet-name>Faces Servlet<servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
这样,您可以通过http://example.com/context/page.xhtml
而不是http://example.com/context/faces/page.xhtml
打开JSF页面,以触发FacesServlet
(即负责所有JSF工作的人).
This way you can open the JSF page by http://example.com/context/page.xhtml
instead of http://example.com/context/faces/page.xhtml
in order to trigger the FacesServlet
(it's namely the one responsible for all the JSF works).
或者,当您实际使用旧版JSF 1.x和/或实际使用旧版JSP而不是其后续产品Facelets(XHTML)时,则可以使用*.jsf
.
Or, when you're actually using legacy JSF 1.x and/or when you're actually using legacy JSP instead of its successor Facelets (XHTML), then you could use *.jsf
instead.
<servlet-mapping>
<servlet-name>Faces Servlet<servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
这样,您可以通过http://example.com/context/page.jsf
而不是http://example.com/context/faces/page.jsp
打开JSF页面.
This way you can open the JSF page by http://example.com/context/page.jsf
instead of http://example.com/context/faces/page.jsp
.
这篇关于在WAS服务器上设置应用程序URL,/faces/来自哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!