File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Spring in Action this week in the Spring 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