Struts help

D

danparker276

I want to set the value of my select box, but can't get the value in
there.


The following, works perfect:
<html:select property="selectedShortCodeL" value="400">
<html:eek:ptionsCollection name="ctform" property="shortCodeList"
label="name" value="name"/>
</html:select>

But I want to make value dynamic.
<bean:write name="ctform" property="scSet"/> This value is 400, but
how do I put it in the select property?

This doesn't work:
<html:select property="selectedShortCodeL" value="scSet">
<html:eek:ptionsCollection name="ctform" property="shortCodeList"
label="name" value="name"/>
</html:select>
 
T

Tim Slattery

I want to set the value of my select box, but can't get the value in
there.


The following, works perfect:
<html:select property="selectedShortCodeL" value="400">
<html:eek:ptionsCollection name="ctform" property="shortCodeList"
label="name" value="name"/>
</html:select>

But I want to make value dynamic.
<bean:write name="ctform" property="scSet"/> This value is 400, but
how do I put it in the select property?

This doesn't work:
<html:select property="selectedShortCodeL" value="scSet">
<html:eek:ptionsCollection name="ctform" property="shortCodeList"
label="name" value="name"/>
</html:select>

Use the EL version of the tag:

<html-el:select property="selectedShortCodeL" name="ctform"
value="${ctform.scSet}" />
 
T

Tim B

I want to set the value of my select box, but can't get the value in
there.


The following, works perfect:
<html:select property="selectedShortCodeL" value="400">
<html:eek:ptionsCollection name="ctform" property="shortCodeList"
label="name" value="name"/>
</html:select>

But I want to make value dynamic.
<bean:write name="ctform" property="scSet"/> This value is 400, but
how do I put it in the select property?

This doesn't work:
<html:select property="selectedShortCodeL" value="scSet">
<html:eek:ptionsCollection name="ctform" property="shortCodeList"
label="name" value="name"/>
</html:select>

initialize the property "selectedShortCodeL" in your form bean to the
desired value. This can be done in initializer action or in the form bean's
reset method
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top