This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
  • salvin francis
  • Mikalai Zaikin
  • 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!
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic