• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in call to RequestDispatcher.include() method

 
Mandar Velankar
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one solve the following error asap.

When I obtained RequestDispatcher object with following code I get following exception

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.IllegalArgumentException: Path does not start with a "/" character
com.Production.sdc.servStyleSample.service(servStyleSample.java:352)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.


Code written :

ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("/exists.jsp?formnm=create_stylesample.jsp&chksts=Exists"); // this line generate error
rd.include(req, res);

Thanks & Regards,

Mandar Velankar
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was the forward slash there initially or did you go back and add it?
If you went back and added, are you sure the class was recompiled?
If so, are you sure the recompiled class was loaded?
 
Mandar Velankar
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben
Thanks for reply.

"/" was included right from beginning , as per language requirement "/" must
be included to obtained relative path while getting RequestDispatcher object.Earlier I am not getting such kind of error , can any one find out more. Servlet is recompiled and loaded through Tomcat Manager , reload option available .Also where can I find out context path set for application in NetBeans IDE 3.6 and Tomcat environment.

Thanks & regards

Mandar Velankar
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat doesn't recompile servlets.
The reloadable attribute of the <Context .. /> entry will reload the app if a compiled class file is update but you need to compile it yourself.


The HttpServletRequest object has a getContextPath method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic