You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hans-Peter Petek <pe...@mazda.at> on 2006/02/23 11:24:12 UTC

logic:iterate

Hi,

does anyone knows a really good docu (with examples) how to use the
iteration (with indexed tags)?

Because my indexed iteration is not working, the first time the values are
fine (loading), but after submitting the data, the changes are not mapped to
the array (or arraylist).

Here is the problem again, maybe someone knows a good doc or has an idea
...?

I have modified the iteration from <logic:iterate id="right" ... to
<logic:iterate id="rightlist_ary" ... because that's my array I want to have
filled, but after submitting the form I get ... 
[BeanUtils.populate]: java.lang.NullPointerException

any ideas? help would be great, thanks.


*** *** ***

i have a problem with the logic:iterate tag ... i want to show a list of
objects (which habe attributes with values of 0 or 1 or 2)

I want to show them in a list of radio-elements

OBJECT 1          0 1 2    0 1 2    0 1 2
OBJECT 2		0 1 2    0 1 2    0 1 2
...

where 0,1,2 is a radio-element (one of 0 or 1 or 2 can be choosen).



public class AuthRightForm extends ActionForm {

	private Right[] rightlist_ary;

	get / set ...

	// after loading
	rightlist_ary = new Right[10];
	// filling rightlist_ary from DB ...
	...


<logic:iterate id="right" name="authRightForm" indexId="idx"
property="rightlist_ary">
<tr>
	<logic:present name="right">
	<logic:notEmpty name="right">
	<td><bean:write name="right"/>, Index = <bean:write name="idx"/>
					
	<td><html:radio name="right" property="val_owner" value="0"
indexed="true"/></td>
	<td><html:radio name="right" property="val_owner" value="1"
indexed="true"/></td>
	<td><html:radio name="right" property="val_owner" value="2"
indexed="true"/></td>
	
	</td>
	</logic:notEmpty>
	</logic:present>
</tr>
</logic:iterate>


The displaying of the values is working, so if Object 1, property 1 has a
value of 2, the 3rd radio-element is selected - this works fine. But, after
submitting the form, I do not see the changed values (if I change the
radio-buttons). The value of rightlist_ary is always null - so I do not see
any objects in the list any more.

The request-object has values like that:
right[3].val_owner -> 1
right[2].val_owner -> 2
right[1].val_owner -> 1
...

Does anyone has a solution for that?

Thanks a lot
HP



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org