aspose file tools
The moose likes Servlets and the fly likes Have problem with getResource()! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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: 17228
    
    1

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Have problem with getResource()!
 
Similar Threads
calling java code from javascript in jsp file
Subtracting Time (Date) in JSP
equality operator still confuses me...
doubt in jsp implicit objects......
How do you link 8k with 12264 ?