Main com.motorola.triage.MainServlet<" /> Main com.motorola.triage.MainServlet<" /> Main com.motorola.triage.MainServlet<"/>

Root "/" mades server load index.html before pass through the servlet

213 Views Asked by At

I have a Servlet that is mapped to the root directory "/":

<servlet>
    <servlet-name>Main</servlet-name>
    <servlet-class>com.motorola.triage.MainServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Main</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

In this servet there is a couple of small things that are done there, like authentication and retrieve of Google Plus information. After that, I'm doing a forward to a JSP file called "index.jsp"

req.getRequestDispatcher("index.jsp").forward(req,resp);

When I'm accessing "localhost:8080/" the static file "index.jsp" is loaded without passing through the servlet. For architecture reasons I can not change the name of index.jsp. I would like to ask if is there any way to change this behavior of the server and make it look to the servlet before look the index.jsp file.

1

There are 1 best solutions below

2
Alex On

This is occurring specifically because you used the name index.jsp.

This has been covered elsewhere, such as here and here and here.