File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to give dynamic values in html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "How to give dynamic values in html:select" Watch "How to give dynamic values in html:select" New topic
Author

How to give dynamic values in html:select

Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
I want to set the dynamic value for styleId. how to set?
The below one is not working..

<html:select property="money" name="Output" styleId="<bean:write name='Output' property='flag'/>"">
<html ption...
</html:select>

the generated html file for the above one

<select name="money" id="<bean:write name='Output' property='flag'/>">
<option...
</select>

but, I want the generated html to be:

<select name="money" id="Rupees">
<option...
</select>


<select name="money" id="Dollars">
<option...
</select>

Ruppes, Dollars are based on the flag attribute of the form bean..

How to aciheve this?


Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The reason your code doesn't work is that you can't embed one custom tag inside another.

If your web application is a Servlet version 2.4 application, you can simply use an EL expression. Example: styleId="${Output.flag}"

If your application is Servlet 2.3 or earlier, you can accomplish the same thing by using the struts-el version of the tags.
[ September 12, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to give dynamic values in html:select
 
Similar Threads
Disabling html:select by form bean property
Struts Iterator Issue
Dynamic selection in Combobox
Problem in populating data with html:select
dynamic value to be submitted to form beans