我LookupdispatchAction
在struts 1.x中使用。我想使用 JQuery ajax 调用文件getData
在类中调用一个方法。下面是我使用三个按钮的 JSP 代码。当我点击get按钮时,应该通过ajax调用来调用struts方法。Action
Struts-config
getdata
<html>
<head>
<script type="text/javascript">
var popup1 = false;
function openPopUp(id) {
}
</script>
</head>
<body bgcolor="skyblue">
<html:form action="/Appointment">
<table>
<tr><td><html:errors /></td></tr>
<tr><td>PatientName:<html:text property="PatientName" /></td></tr>
<tr><td>Time:<html:text property="Time" /></td></tr>
<tr><td>INTime:<html:text property="INTime" /></td></tr>
<tr><td>DoctorName:<html:text property="DoctorName" /></td></tr>
<tr><td><html:submit property="method" value="register" /></td></tr>
<tr>
<td>
<input type="button" onclick="openPopUp('popup1')" value="get" />
<div id="popup1" class="popup"></div>
</td>
</tr>
<tr><td><html:submit property="method" value="delete" /></td></tr>
</table>
</html:form>
</body>
</html>
Struts 配置文件
<struts-config>
<form-beans>
<form-bean name="dynaRegistrationForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="PatientName" type="java.lang.String" />
<form-property name="Time" type="java.lang.String" />
<form-property name="INTime" type="java.lang.String" />
<form-property name="DoctorName" type="java.lang.String" />
</form-bean>
</form-beans>
<action-mappings>
<action type="doctor.Appointing"
name="dynaRegistrationForm"
path="/Appointment"
input="/Apoint.jsp" parameter="method" scope="request">
<forward name="success" path="/Apoint.jsp" />
</action>
</action-mappings>
<message-resources parameter="apps"/>
</struts-config>