In one of J2EE project, we are using DWR libary. Being familiar with simple ajax calls and little DWR, I am not able to figure out which service call is used on our backend on clicking the submit button in one of our spring forms.
KRIDeclaration.jsp file: Spring Form tag :
<form:form commandName="KRIDeclarationCommand" name="krideclaration" method="post" enctype="multipart/form-data">
........
Submit button: <td height="20" colspan="4" align="right" class="dvtCellLabel">
<div align="center"><span style="padding-top: 5px;"> <input
class="btnstyle" type="button" name="btnSendForApproval"
value="Submit" onClick="declareIncident();" />
KRIDecleration.js
declareIncident()
{
Basic front end Validation
Backend Validation using DWR generated js file with a callback
}
callbackmethod(Result)
{
if (success)
document.krideclaration.submit();
else
//code for displaying errors.
}
dwr-context.xml:
dwr:annotation-scan base-package="com.abc.riskdashboard.common" scanDataTransferObject="true" scanRemoteProxy="true" />
<!-- DWR will map util.js and engine.js files to the dwrController.
You can then include this files as external Javascript references from your JSP -->
<dwr:url-mapping />
<!-- Defines the dwrController. During production, set the debug property to false -->
<dwr:controller id="dwrController" debug="true" />
<!-- This is required if you want to configure any beans not managed by
Spring. Leaving it enabled doesn't do any negative effects.
-->
<dwr:configuration>
<dwr:convert type="bean" class="com.abc.riskdashboard.common.dto.RiskAreaMasterDTO" />
<dwr:convert type="bean" class="com.abc.riskdashboard.common.dto.RiskIndicatorDTO" />
<dwr:convert type="bean" class="com.abc.riskdashboard.common.dto.RiskDeclarationDTO" />
<dwr:convert type="bean" class="com.abc.riskdashboard.common.dto.UserMasterDTO" />
<dwr:convert type="bean" class="com.abc.riskdashboard.common.dto.RoleMasterDTO" />
Need to find out what document.krideclaration.submit() in KRIDecleration.js calls when success. There is not submit function or action attribute in spring form