• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

select tag in struts

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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})"
 
reply
    Bookmark Topic Watch Topic
  • New Topic