Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Trouble with <html:submit>

Marshall Levin

2007-05-11

Replies:

Hi,

I have a page that has a tag like this:

  <html:submit property="submit" value="Preview Post"/>

Now I am adding a feature that will automatically submit the form under
certain circumstances, so I have some Javascript like this:

  document.postForm.submit();

I can see from
http://www.chovy.com/personal/javascript-error-submit-is-not-a-function/
and http://www.mail-archive.com/user@(protected)
that this won't work if there is any form element named "submit" -- so I
finally got the Javascript submit to work by renaming my Struts submit
button.

But unfortunately, if I name it anything other than "submit," things
break once the form is actually submitted to the action. Specifically,
if I don't use property="submit" but rather property="foo," I will get
an IndexOutOfBoundsException coming from somewhere in PropertyUtils. As
soon as I set it back to property="submit," it works again (but of
course my Javascript submit stops working).

Any way around this? Does Struts require that the property be "submit"
here? I can't find anything in *my* code that's specifically looking for
a request parameter named "submit."

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.