You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/12/05 15:53:19 UTC
DO NOT REPLY [Bug 17977] -
loses index with jsp:include
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17977>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17977
<nested:iterate> loses index with jsp:include
ckudlac@hotmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
------- Additional Comments From ckudlac@hotmail.com 2003-12-05 14:53 -------
Re-opened the 17977 defect.
DESCRIPTION OF POTENTIAL BUG:
When using more than one jsp:include within a JSP and combined with the
nested:root, the proper nesting level becomes incorrect or inaccessible. Any
JSP which has more than one nested jsp:include will fail upon return from the
inclusion at the next nested call to retrieve a property at the current nesting
level. An interesting note: the following example works when using the Struts
1.1 Beta 2 jar, but fails when using the RC2 jar.
EXAMPLE:
The following example code is attached to allow for recreation. This code was
deployed and tested running on JBoss 3.2 with the distributed/included Tomcat
version.
******** StrutsBaseForm.java
public class StrutsBaseForm extends ActionForm
implements java.io.Serializable {
//--------------------
//- MEMBER VARIABLES -
//--------------------
public ArrayList listBeans = null;
public String junk = null;
//----------------
//- CONSTRUCTOR -
//----------------
public StrutsBaseForm() {
// Pre-populate the objects with dummy information
this.listBeans = new ArrayList();
this.listBeans.add(new StrutsInnerBean("One", "1"));
this.listBeans.add(new StrutsInnerBean("Two", "2"));
this.listBeans.add(new StrutsInnerBean("Three", "3"));
this.listBeans.add(new StrutsInnerBean("Four", "4"));
this.listBeans.add(new StrutsInnerBean("Five", "5"));
this.junk = "1";
}
.... accessor methods not listed
} // End class StrutsBaseForm
******** StrutsInnerBean.java
public class StrutsInnerBean implements java.io.Serializable {
//--------------------
//- MEMBER VARIABLES -
//--------------------
public String displayLabel = null;
public String displayValue = null;
//----------------
//- CONSTRUCTOR -
//----------------
public StrutsInnerBean(String displayLabel, String displayValue) {
// Pre-populate the objects
this.displayLabel = displayLabel;
this.displayValue = displayValue;
}
.... accessor methods not listed
} // End class StrutsInnerBean
******** testBase.jsp
<%-- Uses defined form-bean referencing the StrutsBaseForm class --%>
<nested:form action="/testNested.do" >
<jsp:include page="testInnerOne.jsp" />
</nested:form>
******** testInnerOne.jsp
<nested:root>
<nested:present property="listBeans">
<nested:iterate id="currentBean" property="listBeans">
<jsp:include page="testInnerTwo.jsp" />
</nested:iterate>
</nested:present>
<%-- At this point, the JSP errors with an exception stating:
JasperException: No bean found under attribute key --%>
<nested:equal property="junk" value="1">
<jsp:include page="testInnerJunk.jsp" />
</nested:equal>
</nested:root>
******** testInnerTwo.jsp
<nested:root>
<nested:write property="displayLabel" />:
<nested:text property="displayValue" size="30" />
</nested:root>
******** testInnerJunk.jsp
<nested:root>
Inner junk value: <nested:write property="junk" />
</nested:root>
Please feel free to contact me for information: ckudlac@hotmail.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org