Consider the following JSP Pages
Main.jsp
--------
<%@ taglib uri="bean" prefix="bean" %>
<bean:define id="poweredbyTitle"
value="<h2>Economic Report By County</h2>"
toScope="request" />
<jsp:include page="PoweredBy.jsp" flush="true"/>
PoweredBy.jsp
-------------
<%@ taglib uri="bean" prefix="bean" %>
<bean:write name="poweredbyTitle" filter="false"/>
Is Powered By...
The 'bean:write' is able to find 'poweredbyTitle' in
request scope. However, if I use the following 'Main.jsp'
page with 'bean:include':
Main.jsp<2>
-----------
<%@ taglib uri="bean" prefix="bean" %>
<bean:define id="poweredbyTitle"
value="<h2>Economic Report By County</h2>"
toScope="request" />
<bean:include id="poweredby" forward="poweredby" />
Assuming correct Global Forward...the 'PoweredBy.jsp' page
is not able to locate find the attribute 'poweredbyTitle'
in any scope (as far as I can tell), and an empty String
is printed. Note that if I use (in Main.jsp)
'toScope="session"' instead, it all works fine.
Is this the expected behavior, or a bug? (I'll make the
appropiate bug-report if necessary.)
Thanks,
Gidado
p.s. From looking at org.apache.struts.taglib.IncludeTag:
public int doStartTag() throws JspException {
URL url = hyperlink();
URLConnection conn = null;
try {
conn = url.openConnection();
conn.setAllowUserInteraction(false);
conn.setDoInput(true);
conn.setDoOutput(false);
conn.connect();
it is apparent that there is no use of a RequestDispatcher
(which, I'm assuming, would help in keeping track of
'request' scoped attributes).