I spent a good hour hunting down the source of my problem with trying to
programmatically submit a form and thought I'd share the solution for others
who are using struts. I wanted to have a select list automatically cause its
containing form to submit when the value of the select list changed. This is
useful for simple sorts or subsearches in a search result list.
In my JSP page, I had the following code:
<html:select property="mySelectName"
onchange="this.form.submit()">
<html:options name="mySelectOptionCollection">
</html:select>
I kept getting "Object doesn't support this property or method" from my
browser. Finally I figured out that by default, struts gives <html:submit/>
tags a name of "submit". Thus there was a namespace collision in the form
object, with the submit button overriding the form's submit method. I fixed
the problem by changing the name of the submit button. Something like this
works great:
<html:submit property="submitProperty" value="The Label I Want"/>
Perhaps the default name for submit buttons could be changed in struts in
the future to avoid such namespace collisions, especially with very standard
methods and properties like form.submit?
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>