This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes select tag in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "select tag in struts" Watch "select tag in struts" New topic

select tag in struts

Prams Coolkarni

Joined: Nov 01, 2005
Posts: 12
Hi folks i have a small problem. I am using the <html:select>tag in my JSP and calling the function written in javascript from it. Now i want to pass the value through this function and to do that i am writing the <bean:write> tag in it. but it is showing me syntax error how can i solve it. My code something like this

<html:select id='1" name="name1" property="property1" onChange="fun(<bean:write name="formname" property="formvariable"/> ">
<html ptions collections name="array" property="value" />
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You cannot use a <bean:write> tag inside an <html:select> tag. You can use a scriptlet, however, provided the whole attribute is a scriptlet. Something like this would work:

<html:select property="mySelect" onChange='<%="fun("+formname.getFormVariable()+")" %>' />

Another alternative would be to use the struts-el version of the tag, in which case you could put an EL expression in the tag as in:


Consultant, Sima Solutions
I agree. Here's the link:
subject: select tag in struts
It's not a secret anymore!