• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about jsp:include  RSS feed

 
Steve Mutanson
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:include> action can dynamically load a page inside another one. If user calls a "MyServlet" servlet and this servlet do a "forward(req, res)" to "result.jsp". The "result.jsp" includes a "header_part.jsp" by using "<jsp:include ..>" syntax.
The issue is, the "header_part.jsp" content should be dynamically changed based on what parameter user has send in the first place (http://MyServlet?param1=abc). So, in the "header_part.jsp" if I use "request.getParameter(param1)", can I get the value ? I know in "result.jsp" page it definitely can get because the servlet forwards to it. Can I get it in "header_part.jsp" ?
 
Geeta Ramasami
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Yes its possible to retrive a request parameter in the header.Though u forward the request object from servlet to Request.jsp,the header.jsp is included in Request.jsp.So u can access the parameter in header.jsp.As jsp include tag is the dynamic include of the JSP, once the request object from servlet becomes available only,the header.jsp executes.
Cheers
Geeta
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!