• Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext getResource()  RSS feed

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
context.getResource("/files/test.jar");

It's mentioned in Hanumant Deshmik's book : You cannot pass a URL of any active resource-for example, a JSP page or servlet- to this method.

But even the following code is working :
context.getResource("/files/testing.jsp");
 
Saurabh Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getResource() and getResourceAsStream()- both these methods send the content of the filename specified as argument.
So,
context.getResource("/files/testing.jsp");

would return the jsp source code not the output generated by "testing.jsp"

So, this would work(no errors) but make sure this is what you wanted to send, contents or generated output...

Thanks and regards,
Saurabh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!