File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 :
view = request.getRequestDispatcher("result.jsp");
Here i can also use
view = request.getRequestDispatcher("/result.jsp");
view = getServletContext().getRequestDispatcher("/result.jsp");
Here can i use
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
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.
It is sorta covered in the
JavaRanch Style Guide
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-2015