9

簡単なテスト Web アプリケーションがあります: 最初のページ - index.xhtml:

<?xml version='1.0' encoding='UTF-8' ?>
<html>
 <h:head>
    <title>Facelet Title</title>
 </h:head>
 <h:body>
    First page
    <h:form>
        <h:commandButton value="Go to Next page" action="next"/>
    </h:form>
 </h:body>
</html>

および次のページ - next.xhtml:

<?xml version='1.0' encoding='UTF-8' ?>
<html>
<h:head>
    <title>Facelet Title</title>
 </h:head>
 <h:body>
    Next page
    <h:form>
        <h:commandButton value="Go to First page" action="index"/>
    </h:form>
 </h:body>
</html>

アプリケーションを実行すると、ブラウザにその URL が表示されます。

http://localhost:8080/Test/ 

最初のページとして index.xhtml 。

次に、「次のページに移動」をクリックすると、URLがあります

http://localhost:8080/Test/index.xhtml

そして next.xhtml ページ。そして、「最初のページに移動」をクリックすると、ページが(index.xhtmlに)変更されますが、そのURL

http://localhost:8080/Test/next.xhtml

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
 <context-param>
     <param-name>javax.faces.PROJECT_STAGE</param-name>
     <param-value>Development</param-value>
 </context-param>
 <listener>
     <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
 </listener>
 <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>
 <session-config>
     <session-timeout>
         30
     </session-timeout>
 </session-config>
 <welcome-file-list>
     <welcome-file>index.xhtml</welcome-file>
 </welcome-file-list>
</web-app>

アプリケーションの最初のページに URL があるようにするにはどうすればよいですか?

http://localhost:8080/Test/index.xhtml 

それよりも

http://localhost:8080/Test/

?

Tomcat (TomEE)/7.0.37 を使用しています

4

2 に答える 2