eclipse dynamic web project - default start page

前端 未结 5 1558
一整个雨季
一整个雨季 2020-12-31 11:05

I created in Eclipse dynamic web project, I have index.html in WEB-INF folder. I click on the main folder of the project Run as > Run on server chose Tomcat v7.0, finish, a

相关标签:
5条回答
  • 2020-12-31 11:46

    Open Eclipse-> click on servers-> choose Tomcat v9.0 Server at localhost-config-> select "web.xml"-> scroll to the bottom or find " "-> "filename.xml"

    image

    0 讨论(0)
  • 2020-12-31 11:48

    this also happens when there is a 404 error, Tomcat searches by default for the index file. jsp/html , you must change it from the Tomcat folder in the web.xml file.inside of Tomcat Eclipse or in installed folder system(c/files Program/apache...) o look at this example

    0 讨论(0)
  • 2020-12-31 11:49

    1) How can I change the default page ?

    => change welcome file list in web.xml. Change to your desired filename whichever you are using.

    2) can I put in default page asp file ?

    => you can change extension to asp, but you need servlet mapping in web.xml. But if you are talking about Microsoft ASP pages, I think you won't be able to add them as per my knowledge as both(jsp and asp) resides under different technologies

    EDIT :

    <?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_2_5.xsd" id="WebApp_ID" version="2.5">
      <display-name>MyFirstServlet</display-name>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
      <servlet>
        <description>new</description>
        <display-name>GrettingServlet</display-name>
        <servlet-name>GrettingServlet</servlet-name>
        <servlet-class>GrettingServlet</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>GrettingServlet</servlet-name>
        <url-pattern>/greetings.asp</url-pattern>
      </servlet-mapping>
    </web-app>
    

    Here you will make request to GreetingServlet using url http://localhost:8080/myapp/greetings.asp

    0 讨论(0)
  • 2020-12-31 11:54

    Few things to check.

    1) Servlet mapping extension in web.xml
    2) Welcome file definition in web.xml
    

    Make sure there extension & name are as you changed.

    web.xml will be inside WEB-INF folder.

    0 讨论(0)
  • 2020-12-31 11:55

    In web.xml (under TOMCAT_HOME/webapps/you_application) you have this:

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

    change to your new file name

    0 讨论(0)
提交回复
热议问题