I am using LookupdispatchAction
in struts 1.x. I want to call a method getData
in Action
class using JQuery ajax call Struts-config
file. Below is my JSP code where I am using three buttons. When I click on the get button, then struts getdata
method should be called through ajax call.
<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-config file
<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>