wood burning stoves 2.0*
The moose likes Servlets and the fly likes File root config problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File root config problem" Watch "File root config problem" New topic
Author

File root config problem

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
Let's say I got a server http://mydomain.com
Annd I have a page http://mydomain.com/forms/new/add.jsp that posts to a servlet
http://mydomain.com/ProcessForm
In my servlet I have
getServletContext().getRequestDispatcher(viewTemplate).forward(req, res);
where viewTemplate = "/thankyou.jsp"
Now thankyou.jsp is located here http://mydomain.com/forms/new/thankyou.jsp
Now if I user that forward it tries to look for:
http://mydomain.com/thankyou.jsp
I do nto want to hardcode the /forms/new inside of my viewTemplate, becasue the names of the paths might change, but the structure will still be the same.
How do I code it where it knows to forward to http://mydomain.com/forms/new/thankyou.jsp
and not to http://mydomain.com/thankyou.jsp without hardcoding.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

check your other post

http://www.coderanch.com/t/357223/Servlets/java/Why-RequestDispatcher-null

so, the answer is to use:

request.getRequestDispatcher()

and remove the leading '/'
 
 
subject: File root config problem