A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Feb 12, 2010
Jul 20, 2010 19:53:41
There are two ways of getting a requestDispatcher :
1. RequestDispatcher view = request.getRequestDispatcher("result.jsp");
Here i can also use RequestDispatcher view = request.getRequestDispatcher("/result.jsp");
2. RequestDispatcher view = getServletContext().getRequestDispatcher("/result.jsp");
Here can i use RequestDispatcher view = getServletContext().getRequestDispatcher("result.jsp") or would it give me an error..saying the location has to start from root ??;
Joined: Apr 25, 2010
Jul 20, 2010 20:30:24
you get a RequestDispatcher in two ways from the request or from the context. With the
context you MUST include the foward slash because you can't specify a path relative to the current resource (the one that received this request.
Hope this helps.
I agree. Here's the link:
getRequestDispatcher error in servlets
HTTP Status 500
damn the requestDispatcher
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014