gpt4 book ai didi

jsf - 我想要 http ://localhost:8080/to have the same effect as accessing http://localhost:8080/basicSetup/index. xhtml

转载 作者:行者123 更新时间:2023-11-28 23:02:37 25 4
gpt4 key购买 nike

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web- app_2_5.xsd" 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>basic setup</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>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index.faces</welcome-file>
</welcome-file-list>

它应该从像 www.example.com 这样的域访问,而不显示 www.example.com/basicsetup。

最佳答案

明智的做法是通过 Tomcat 7 server documentation关于这个问题,特别是后面的部分,为大家朗诵如下(强调我的:

The Context element represents a web application, which is run within a particular virtual host. Each web application is based on a Web Application Archive (WAR) file ...

The web application used to process each HTTP request is selected by Catalina based on matching the longest possible prefix of the Request URI against the context path of each defined Context.

You may define as many Context elements as you wish. Each such Context MUST have a unique context name within a virtual host. The context path does not need to be unique (see parallel deployment below). In addition, a Context must be present with a context path equal to a zero-length string. This Context becomes the default web application for this virtual host, and is used to process all requests that do not match any other Context's context path.

因此,总结一下:您需要 <Context path="" ... />定义如描述here .

您可以在 HOWTO set the context path of a web application in Tomcat 7.0 的答案中找到所需的详细信息问题。

关于jsf - 我想要 http ://localhost:8080/to have the same effect as accessing http://localhost:8080/basicSetup/index. xhtml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16381980/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com