Professional Documents
Culture Documents
Struts JS
Struts JS
<a href='javascript:void(document.forms["myForm"].submit()>My
Link</a>
Now the trick in the action is to decode what action you intend to perform. Since you are
using JavaScript, you could set a field value and look for it in the request or in the form.
... html/javascript part ...
if (myAction.equals("save") {
// ... save action ...
} else if (myAction.equals("delete") {
// ... delete action ...
}
}
}
}
This is just one of many ways to achieve submitting a form and decoding the intended
action. Once you get used to the framework you will find other ways that make more
sense for your coding style and requirements. Just remember this example is completely
non-functional without JavaScript.
//*****************************************************************************
****
submit form using javascript in struts