You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yujin Kim <yk...@netexplode.com> on 2003/01/17 06:07:15 UTC

Group of radio buttons with indexed="true" within nested iterate

Hi

I'm having some issues with indexed="true" and nested iterate tags. I'm
hoping some of you would be able to give me some directions.  BTW, I had
to strip out the orignial source code.  I apologize for that if this
makes difficult to follow.  I'd be happy to provide more details in
private channel.

My jsp looks like this:

<logic:iterate id="item" name="theForm" property="itemList"
type="ItemBean">
	<logic:iterate id="idValueBean" name="theForm"
property="idValueBeanList" type="IdValueBean">
		<html:radio idName="idValueBean" value="id" name="item"
property="itemTypeId" indexed="true"/>
	</logic:iterate>
	<html:text name="item" property="itenName" indexed="true"/>
</logic:iterate>

theForm is the form bean contains the following:
	itemList - java.util.List of ItemBean
	idValueBeanList - java.util.List of IdValuBean which represents
lookup table in the database

ItemBean is a simple bean that has some properties in primitive data
types that represents a row.
Say ItemBean holds the following properties [ int itemId; int
itemTypeId; String itemName ]

IdValueBean is another simple bean that contains id and value of a
lookup table.
We can presume that IdValueBean represents a single in item_type_lu
lookup table.

So what I need to do is have the html come out as follows
	[input type="radio" name="item[0].itemTypeId" value"1"]
	[input type="radio" name="item[0].itemTypeId" value"2"]
	[input type="radio" name="item[0].itemTypeId" value"3"]
	[input type="radio" name="item[0].itemTypeId" value"4"]
	[input type="text" name="item[0].itemName" value="some item
name"]

	[input type="radio" name="item[1].itemTypeId" value"1"]
	[input type="radio" name="item[1].itemTypeId" value"2"]
	[input type="radio" name="item[1].itemTypeId" value"3"]
	[input type="radio" name="item[1].itemTypeId" value"4"]
	[input type="text" name="item[1].itemName" value="some item
name"]

	......

But with the above jsp code, I end up having an html code that looks
like this:
	[input type="radio" name="item[1].itemTypeId" value"1"]
	[input type="radio" name="item[2].itemTypeId" value"2"]
	[input type="radio" name="item[3].itemTypeId" value"3"]
	[input type="radio" name="item[4].itemTypeId" value"4"]
	[input type="text" name="item[0].itemName" value="some item
name"]

	[input type="radio" name="item[1].itemTypeId" value"1"]
	[input type="radio" name="item[2].itemTypeId" value"2"]
	[input type="radio" name="item[3].itemTypeId" value"3"]
	[input type="radio" name="item[4].itemTypeId" value"4"]
	[input type="text" name="item[1].itemName" value="some item
name"]

	.......

I was trying to learn how to use nested tag hoping it might solve the
problem, but I didn't quite get how to use it.

Any help would be greatly appreciated.

Thanks

Yujin Kim



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>