singh
singh

Reputation: 309

Assign hidden value using Struts2 tag

How assign the hidden value using Struts tag inside of iteration. My JSP code looks like this:

<s:iterator value="collegelist">
    <s:hidden name="hiddenname" value='<s:property value="collegename"/>'/>
</s:iterator>

It takes hidden field's value as a string it show on alert:

<s:property value="collegename"/>

JavaScript code:

var text = myForm.hiddenname.value;
alert(text);

Upvotes: 0

Views: 4285

Answers (1)

Liviu T.
Liviu T.

Reputation: 23664

<s:iterator value="list">
  <s:hidden name="hidden" value="%{property}" />
</s:iterator>

Upvotes: 3

Related Questions