This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • 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