Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Referencing JSP files in WEB-INF folder

 
Salvador Cecilio
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 582 ("Making static content and JSPs directly Accessible") of the Head First Servlets & JSP book, there is a signUP.jsp file in the MyTestApp root application directory. The corresponding view JSP file is process.jsp directly under in the WEB-INF folder.

How does the /signUp.jsp file (or intermediary servlet) dispatch itself to /WEB-INF/process.jsp?

I'd like to see code that would make it happen as the book doesn't seem to go into it in detail.
[ June 06, 2006: Message edited by: Salvador Cecilio ]
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
signup.jsp is for client who can make the direct request for this page, but process.jsp is if you want to include or forward the contents of this(process.jsp) from other page.

How does the /signUp.jsp file (or intermediary servlet) dispatch itself to /WEB-INF/process.jsp?


Use <jsp:include page="/WEB-INF/process.jsp"/> (To include the contents of process.jsp)
or <jsp:forward page="/WEB-INF/process.jsp"/>(To forward to process.jsp)
 
Salvador Cecilio
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was a bug in my code that prevented the dispatcher from going to the process.jsp.

I have found two ways of accessing a JSP view that is hidden behind the WEB-INF folder:

1) Using the RequestDispatcher.forward() method (JSP or Servlet)
2) Using the web.xml <servlet> and <servlet-mapping> to map to process.jsp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic