aspose file tools*
The moose likes Servlets and the fly likes Have problem with getResource()! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Have problem with getResource()!" Watch "Have problem with getResource()!" New topic
Author

Have problem with getResource()!

Eliot Skywalker
Greenhorn

Joined: Oct 22, 2003
Posts: 18
I've got a question with ServletContext.getResource()
This method returns a java.net.URL object. In the servlet api document, description of this method says:
The resource content is returned directly, so be aware that requesting a .jsp page returns the JSP source code. Use a RequestDispatcher instead to include results of an execution.

my question is, how can a URL "returns the JSP source code"
what does it mean?
Thanks
--Skywalker


Every man dies, not every man really lives.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Skywalker is really your last name? And you are sure you don't have a brother Luke.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The URL returned is based in what the ClassLOader can 'see'. The ClassLoader has access to Files, but nothing else. Therefore the reference to the JSP is a file url and not a http url.
Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Have problem with getResource()!