We currently use the following javascript to submit the form when one of the field values change.
var url = "project/location/myAction.action?name="+ lname ;
document.forms[0].action = url;
document.forms[0].submit();
which calls the following Struts2 action
<action name="myAction" class="project.location.NameAction">
<result name="success" type="tiles">myAction</result>
</action>
which then goes to the execute()
method of the Action class NameAction
where I have to check to see if the form was submitted from the javascript.
I would prefer to call the findName()
method in NameAction
directly from the javascript. In other words I want the javascript to act like the following jsp code.
<s:submit method="findName" key="button.clear" cssClass="submit" >
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…