When you say that you got an exception with the "indexed" attribute, I'm
assuming you mean that you tried to add an "indexed" attribute to the
"c:forEach" tag.  The "indexed" attribute goes on the tags being
iterated over, not the iterate/forEach tag.  The tags which are iterated
over should be able to support an "indexed" attribute whether you're
using "logic:iterate" or "c:forEach".

I believe your "html:hidden" and "html:text" elements need a "name"
attribute, probably with a value of "item".

-----Original Message-----
From: Andy Kriger [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 04, 2004 12:08 PM
To: 'Struts Users Mailing List'
Subject: iteration and EL help needed


This is the problem I am trying to solve.
I want to submit a DynaValidatorForm with multiple hidden/text inputs
that have the same name. This is a list of items and quantities that I
am trying to update with one submit (e.g. itemId, quantity). Is this
what the 'indexed' input attribute is supposed to help with? Will the
validator understand how to apply the rule for itemId to every indexed
instance of itemId? Will DynaValidatorForm receive an array of itemIds
and quantities?

Since the items are stored in a collection, I want to iterate over them,
outputting the input fields. With c:forEach, I get an exception that the
indexed attribute is not supported. With logic-el:iterate, I get a name
attribute that looks like
name="org.apache.struts.taglib.html.BEAN[1].itemId" - that doesn't look
right at all.

I am using Struts 1.1rel (and the struts-el JAR in the contrib dir) with
JSTL 1.0 in Resin 2.x.x. 
Has anyone seen behavior like this and know how I can fix it? 
Or am I barking up the wrong tree trying to submit my form in this
fashion?

Here's a bit of the JSP code...
<%--c:forEach var="item" items="${context_tray.items}"
varStatus="idx"--%> <logic-el:iterate id="item" name="context_tray"
property="items" indexId="idx">
        <html-el:hidden property="itemId" value="${item.id}"
indexed="true"/>
        <html-el:text property="quantity"
value="${context_tray.itemQuantityMap[item]}" size="2" indexed="true"/>
        <br>
</logic-el:iterate>
<%--/c:forEach--%>

thx

Andy Kriger | Software Mechanic | Greater Than One, Inc.
28 West 27th Street | 7th Floor | New York, NY 10001
P: 212.252.7197 | F: 212.252.7364 | E: [EMAIL PROTECTED] 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to