This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Request Dispatcher to JSP  RSS feed

 
vithal k
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys
Pardon the slightly lengthy post as i wanted to be clear in my problem
defnition. I am using Tomcat 3.2.1 on Apache and my application context path
is /application
I have a login.html which, in its POST method calls a servlet called
login(alias name). Now this servlet validates the user and decides where he
has to go based on the user type. then it uses request.setAttribute() and
modifies the request. then it uses request.getRequestDispatcher("").It is
supposed to go to the usertypexxx.jsp, but this is where i get a problem.
if i give the absolute context path like
request.getRequestDispatcher("/application/usertypexxx.jsp") and
requestdispatcher.forward(req,res)My servlet just wont take me there. i get
a file not found error.
if i give the relative path like
request.getRequestDispatcher("/usertypexxx.jsp") and
requestdispatcher.forward(req,res). The servlet runs and i go to the
usertypexxx.jsp but all the html links in the page have a context path
mapped to /application/servlet/usertypedir/abc.jsp where as they are
actually links to /application/usertypedir/abc.jsp.
the problem is that /servlet is getting added to the path.
Now What is this problem , why is this coming and how can i solve this
thanks in advance
 
Margaret Carver
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"vithal k",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think if you check your logs, you'll see the actual pathname of the "not-found" page. Technically, you're supposed to give the absolute path to the forwarder, though I've found that in the real world it doesn't always seem to be required - the restriction may have been relaxed.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!