Reputation: 819
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,
Upvotes: 1
Views: 10213
Reputation: 22382
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
Upvotes: 3