0

I have a servlet with doGet overridden. The relevant pieces would be:

// called from doGet(req,res)
private void serviceInternal(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    log.info("servicing a request");

    // magically compute jsp path from request params (includes the
    // logging of the app/mod/act as mentioned below

   log.info(jspPath);
   request.getRequestDispatcher(jspPath).forward(request, response);
}

Now I'm logging the urls that come into the service method and if the url is server:8080/context/app/mod/act?param=1 the log message would say app='app' mod='mod' act='act' and I've verified that this is working well.

When I try to hit something that should be routing me to a jsp, for some silly reason it sends me back into my doGet method! My log looks like this:

INFO  2015-04-12 21:35:07,511 servicing a request
INFO  2015-04-12 21:35:07,519 app='' mod='' act='' uid='null' 
INFO  2015-04-12 21:35:07,571 /WEB-INF/index.jsp
INFO  2015-04-12 21:35:07,571 servicing a request
INFO  2015-04-12 21:35:07,571 app='WEB-INF' mod='index.jsp' act='' uid='null' 

But I don't want to send my jsp through my doGet - I want to send it to the JSP! Why would it be doing this?

My servlet is catching "/*", if that helps at all. But I wouldn't have expected it to catch jsps.

What am I doing wrong here?

corsiKa
  • 81,495
  • 25
  • 153
  • 204

1 Answers1

0

My servlet is catching "/*", if that helps at all. But I wouldn't have expected it to catch jsps.

You just found the problem yourself. That is the reason.

shazin
  • 21,379
  • 3
  • 54
  • 71