简体   繁体   中英

Form submit using JavaScript in Struts 1.2

I am using Struts in my application.

I am trying to submit a form using javascript. Hence I did this in html file:

<html:form name="returnForm" action="/returnMedia">

and this in <script> tag:

document.forms["returnForm"].submit();

This is normally what we do while submitting a form using javascript.

But in struts 1.2, I am getting an exception, asking me to set the type for the form also.

Checking the docs, it seems this is not the correct way to submit the form in struts 1.2.

Please let me know how to proceed with this.

Thanks,

how about this

{
document.forms[0].action = "UserAction.do?method=add"
document.forms[0].submit();

}

look at this link http://www.dzone.com/tutorials/java/struts/struts-example/struts-dispatch-action-example-1.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM