1 Reply Latest reply: Mar 6, 2012 2:58 PM by DrClap RSS

    Web application in java

    922164
      In a java web application, say MyProject, i have all the jsp pages inside a folder called "/MyProject/pages". The Home page alone is directly inside "/MyProject" . So only when i hit the url http://localhost:8080/MyProject/Home.jsp, this jsp will be opened from where i can proceed further.

      But i don't want to give the home page name in the url. For eg: If i give the url as http://localhost:8080/MyProject and press enter, i want this Home.jsp to be loaded. How do i do that?

      In web.xml, i tried to map like given below. Is it a correct approach?

      <servlet>
           <servlet-name>DefaultPage</servlet-name>
           <jsp-file>/Home.jsp</jsp-file>
      </servlet>
      <servlet-mapping>
           <servlet-name>DefaultPage</servlet-name>
           <url-pattern>/SingleMarket/*</url-pattern>
      </servlet-mapping>

      what modification should i do to make this work?
        • 1. Re: Web application in java
          DrClap
          That's called a "welcome page" and so you'll want to put a <welcome-file> element into your web.xml referencing that JSP. Like this, probably, depending on what level of servlet spec you're using:
          <welcome-file-list>
            <welcome-file>Home.jsp</welcome-file>
          </welcome-file-list>