Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSP page in WEB-INF

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I have to (simple?) questions.
1) Is it possible to place to a jsp page in WEB-INF?
2) if the first question equals true, how do I create a new instance of that page using a servlet? (Or, in other words: how do I use that jsp page???)
Thanks for your help, if someone could help me, if would be great!
Erik
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erik:
The J2EE Servlet 2.3 spec says that the WEB-INF node is not a part of the public document tree of an application and no file in this directory can be served directly to the client by the container. The spec does not seem to explicitly specify how to handle cases where a controller servlet or another JSP forwards a JSP page in the WEB-INF directory.
Some app servers like BEA Weblogic 7.0 do not serve up jsp pages from the WEB-INF directory either in response to a direct request from the client or when another JSP/servlet forwards to it. However I came across a book from Sun Press that seems to encourage users to put JSP pages in the WEB-INF directory that they didn't want the client to access directly but could be served up via a jsp/servlet forward.
In summary, you may be trying something that may not be portable across app servers. If your app server behaves like the latter case above, you can refer to the JSP page in the WEB-INF directory from a controller servlet using something like below
getServletContext().getRequestDispatcher("/WEB-INF/exampleFolder/example.jsp").forward(request, response);
Hope this helps.
-- Ashwin
 
I'm sure glad that he's gone. Now I can read this tiny ad in peace!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic