tags:

views:

28

answers:

1

Hi,

I'm trying to define a id of a <nested:hidden filed in struts 1, but with styleId i receive a error:

my code looks something like this:

<nested:iterate id="otherPayList" name="myPayListForm" property="otherPayList"  indexId="rowIndex">

<nested:hidden property="rowStatus"/>

.......

Any idea ?

A: 

The <nested:iterate> tag is an extension for <logic:iterate>.

The property of <nested:hidden> is:

the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String.

The reason you have an error is because Struts can't find a bean of typed to name rowStatus (in the <nested:hidden> tag). You have not specified what errors Struts is throwing (ie, exception logs) so I'm working on what you've given.


If I understand you properly,

you want to do this (provided it's nested in the <nested:iterate> tag).

<nested:hidden name="otherPayList" property="rowStatus" />

For <nested:hidden> tag, there is no attribute called id and setting the id to styleId won't work as styleId looks for a CSS declaration with id matching styleId (i.e. it will look for a css, if styleId="thatId" declared #thatId { }).

See Struts Documentation on nested.tld

The Elite Gentleman
thanks for your quick repply but i've set the bean name '<c:set var="rowCounter" value="0"/>'. the question is how to pun an ID to the '<nested:hidden'?
CristiC
`rowCounter`? where does `rowStatus` come from?
The Elite Gentleman
rowStatus come from otherPayList witch is a list of objects
CristiC
If I understood you properly, see my updated post.
The Elite Gentleman
yes it's ok but how I will retrieve this value in javascript ? document.getElementById("?")
CristiC
Please, explain.....Would you please put more description in your question?
The Elite Gentleman
So i have a '<nested:hidden' filed. What i want is to retrieve his value in javascript with the follwoing command document.getElementById. But currently i'm unable to set the id of the '<nested:hidden' filed. How can i set the id value ?
CristiC
You can't set an id on Struts `nested:hidden` and don't use `styleId` either. See my updated post.
The Elite Gentleman