This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

select tag in struts

 
Prams Coolkarni
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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>
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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})"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic