This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes losing request objects with include Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "losing request objects with include" Watch "losing request objects with include" New topic
Author

losing request objects with include

jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
I am using the
<bean:include id="itemList" page="/displayitem.jsp"/>
tag to include a jsp,
and the usebean tag is in the included jsp,
but when I do this the objects I am putting in
the request are gone, I have tried including an action
instead of directly to the jsp file, and all files are contained
within the same module. No dice.
anyone have any ideas on this one,
thanks in advance
Jesse
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
<bean:include> it does not use RequestDispatcher.include(). Instead, it performs an HTTP request to include the resource, so the included resource gets a whole new request. If you need access to request attributes, use <jsp:include>. It's more efficient too.
- Peter
Andy Deighton
Ranch Hand

Joined: Apr 01, 2003
Posts: 39
Or you can use the jsp page directive <%@ include file=%> which will include the enclosed file and *then* compile your page, thus allowing you to refer to request, session, etc. objects in your inclusion.
Andy
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: losing request objects with include
 
Similar Threads
include Servlet output from a JSP file
question on JSP directive
Question on performance with <jsp:include standard action
getting the response stream from jsp include
JSP Include tag problem