Отправить в форме Spring с использованием библиотеки DWR
В одном из проектов J2EE мы используем библиотеку DWR. Будучи знаком с простыми вызовами ajax и небольшим DWR, я не могу понять, какой сервисный вызов используется в нашем бэкэнде при нажатии кнопки отправки в одной из наших весенних форм.
Файл KRIDeclaration.jsp: тег Spring Form:
<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" />
Нужно выяснить, что document.krideclaration.submit() в KRIDecleration.js вызывает в случае успеха. В весенней форме нет функции отправки или атрибута действия