• Post Reply Bookmark Topic Watch Topic
  • New Topic

Call JSP from Servlet(Urgent)

 
Madhan Kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a servlet(trimrec.java) file which has a javascript button.
When i click the button, i want some attributes that
are set to be passed to a JSP file(/search.jsp).

ServletContext sc = this.getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("/search.jsp");
if (rd !=null) {
// Pass control to the JSP.
try {
rd.forward(request, response);
} catch (Exception e) {
sc.log("Problem invoking JSP.", e);
}
}

This is inside a get method of trimrec.java servlet.
What happens is that my tomcat gets automatically shutdown
when it processes this code...
Please do reply me what to do..This happens because i have codings
followed after the above in the servlet file...
Regards
Madhan
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to do RequestDispatcher rd = request.getRequestDispatcher("/search.jsp");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!