0

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.

Rodrigo Borba
  • 1,334
  • 1
  • 14
  • 21
  • Possible duplicate of [How load servlet on index.jsp](https://stackoverflow.com/questions/15839854/how-load-servlet-on-index-jsp) – Alex Mar 09 '18 at 09:09
  • @Alex it is not duplicated once he wants to call a SERVLET after the JSP is loaded. I just want to access a servlet endpoint when accessing "/", without passing through the JSP. – Rodrigo Borba Mar 09 '18 at 13:28

1 Answers1

0

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

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

Alex
  • 661
  • 1
  • 5
  • 18