简体   繁体   中英

I can't override Tomcat's default Welcome File List

I am trying to override Tomcat's (version 7) default Welcome File List, as its conf/web.xml suggests by declaring a 'welcome-file-list' tag in the following form

<welcome-file-list>
        <welcome-file>estore.html</welcome-file>
        <welcome-file>estore.htm</welcome-file>
        <welcome-file>estore.jsp</welcome-file>
</welcome-file-list>

in my application's web.xml , but I am getting an error like this :

HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.estore_jsp

Any ideas? Thank you.

I would try this:

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
  1. Add the above snippet in your web.xml

  2. Then in index.html, I would use a <link /> tag to forward to my desired landing page, ie estore.html in your case.

This should do it.

The Tomcat default deployment descriptor file is located in TOMCAT_HOME/conf/web.xml.Over there you would find the default description for tag as:

<welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

indent <!-- --> the above code and save the /conf/web.xml file. Now place your code

 <welcome-file-list>
        <welcome-file>estore.html</welcome-file>
        <welcome-file>estore.htm</welcome-file>
        <welcome-file>estore.jsp</welcome-file>
 </welcome-file-list>

in WEB-INF/web.xml of the project and restart the tomcat server you would get the result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM