This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
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 '/'
Don't get me started about those stupid light bulbs.
subject: File root config problem