aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "select tag in struts" Watch "select tag in struts" New topic
Author

select tag in struts

Prams Coolkarni
Greenhorn

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" />
</html:select>
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:

onChange="fun(${formname.formVariable})"


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: select tag in struts