• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Have problem with getResource()!

 
Eliot Skywalker
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Skywalker is really your last name? And you are sure you don't have a brother Luke.
Mark
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic