File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "losing request objects with include" Watch "losing request objects with include" New topic

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
Peter den Haan
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.
I agree. Here's the link:
subject: losing request objects with include
It's not a secret anymore!