Well it works fine for me - so I'm at a loss to explain. Maybe you should post the actual jsp code you are using - you said the jsp code looked like this:
<c:forEach var="item" items="${items}"> <html:text name="item" property="code"/> </c:forEach> but the exception you show is for the EL version of the checkbox tag. Also its better if you post to the struts user list rather than directly to me - someone who knows more than me or has experienced your problem may jump in if you post to the list. Niall ----- Original Message ----- From: "Paul Barry" <[EMAIL PROTECTED]> To: "Niall Pemberton" <[EMAIL PROTECTED]> Sent: Thursday, May 06, 2004 1:42 PM Subject: Re: indexed="true" is only valid within an enclosing iterate tag > I am using Struts 1.1, I just copied jstl.jar, struts.jar and > struts-el.jar into my project lib directory to be sure. Still getting > the exception: > > javax.servlet.jsp.JspException: indexed="true" is only valid within an > enclosing iterate tag > at > org.apache.struts.taglib.html.BaseHandlerTag.prepareIndex(BaseHandlerTag.jav a:663) > at > org.apache.struts.taglib.html.CheckboxTag.doStartTag(CheckboxTag.java:188) > at > org.apache.strutsel.taglib.html.ELCheckboxTag.doStartTag(ELCheckboxTag.java: 531) > > I checked the source code around line 663 of BaseHandlerTag, here is > what it looks like: > > // Look for JSTL loops > if (iterateTag == null) { > Integer i = getJstlLoopIndex(); > if (i != null) { > index = i.intValue(); > found = true; > } > } else { > index = iterateTag.getIndex(); > found = true; > } > if (!found) { > // this tag should only be nested in iteratetag, if it's > not, throw exception > JspException e = new > JspException(messages.getMessage("indexed.noEnclosingIterate")); > RequestUtils.saveException(pageContext, e); > throw e; > } > > > Seems as though getJstlLoopIndex() isn't doing it's job, any ideas why? > I have tried it with declaring the Loop Status in the c:forEach with > varStatus="loop" and without, still get the exception. > > Niall Pemberton wrote: > > > Hmmm. The thinking behind my suggestion was "is jstl working properly for > > you or is the indexed thing just hinding some other root cause" > > > > I'm out of ideas - the only other thing I can think of is what version of > > Struts are you using - I believe jstl was only catered for from Struts 1.1 - > > so if you were using a version before that you would get the message you're > > seeing. > > > > Niall > > > > ----- Original Message ----- > > From: "Paul Barry" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Wednesday, May 05, 2004 10:21 PM > > Subject: Re: indexed="true" is only valid within an enclosing iterate tag > > > > > > > >>Yeah, if I remove the indexed="true", my JSP code looks like this: > >> > >><c:forEach var="item" items="${items}"> > >> <html:text name="item" property="code"/> > >></c:forEach> > >> > >>I get a bunch of HTML inputs like this: > >> > >><input type="text" name="code" value="ABC" /> > >> > >>With different values but all named code. Code is a property of item, > >>and each item in items has a different code. > >> > >>Niall Pemberton wrote: > >> > >> > >>>What happens if you remove the "indexed" attribute from all the > >>><html:text> - does it work properly then (except for the "name" > > > > attribute) > > > >>>is the html page generated OK? > >>> > >>>Niall > >>> > >>>----- Original Message ----- > >>>From: "Paul Barry" <[EMAIL PROTECTED]> > >>>To: <[EMAIL PROTECTED]> > >>>Sent: Wednesday, May 05, 2004 9:49 PM > >>>Subject: indexed="true" is only valid within an enclosing iterate tag > >>> > >>> > >>> > >>> > >>>>I am trying to use indexed properties in a form, as described in James > >>>>Turner's Article "Succeeding With Struts: Indexed Properties and Beans > >>>>as Properties" at http://www.developer.com/java/ejb/article.php/2233591 > >>>> > >>>>The example shows you can use c:forEach with <html:text > >>>>indexed="true"/>, like this: > >>>> > >>>><c:forEach var="lines" items="${purchaseOrderBeanForm.map.lines}" > > >>>> <TR><TD><html:text indexed="true" name="lines" > >>>>property="partNumber"/></TD> > >>>> <TD><html:text indexed="true" name="lines" property="quantity"/></TD> > >>>> <TD><html:text indexed="true" name="lines" > > > > property="price"/></TD></TR> > > > >>>></c:forEach> > >>>> > >>>>But when I try to do that, I get this error: > >>>> > >>>>indexed="true" is only valid within an enclosing iterate tag > >>>> > >>>>Is my code wrong or is the example wrong? > >>>> > >>>>--------------------------------------------------------------------- > >>>>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>>For additional commands, e-mail: [EMAIL PROTECTED] > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >>>--------------------------------------------------------------------- > >>>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]