File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

File root config problem

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
Let's say I got a server
Annd I have a page that posts to a servlet
In my servlet I have
getServletContext().getRequestDispatcher(viewTemplate).forward(req, res);
where viewTemplate = "/thankyou.jsp"
Now thankyou.jsp is located here
Now if I user that forward it tries to look for:
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
and not to without hardcoding.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

check your other post

so, the answer is to use:


and remove the leading '/'
wood burning stoves
subject: File root config problem
It's not a secret anymore!