This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Accessing resources in /WEB-INF/ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Accessing resources in /WEB-INF/" Watch "Accessing resources in /WEB-INF/" New topic
Author

Accessing resources in /WEB-INF/

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi guys, I was wondering if this would be perfectly legal...



thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There are two problems with this.
1.) The WEB-INF directory is off limits to browsers.
2.) Redirecting will cause a new request to be generated (which means you won't have your "error" attribute by the time you get to the JSP).

If you did the same thing with a forward, both problems would be solved.

Response.redirect sends a header down to the browser instructing it to make a new request with the given URL. RequestDispatcher.forward, on the other hand, is handled from within the same request and completely on the server.
The browser never knows that it has happened.
[ August 15, 2006: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thank you very much, my doubts are now cleared!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing resources in /WEB-INF/
 
Similar Threads
ClassNotFoundException: ActionServlet
package javax.servlet.jsp.tagext does not exist
compile error
Not able to view the folder contents
Java bean usage in JSP(s)