multiple action in springMVC

controller

</p><p>@RequestMapping("/actionAgreement")<br /> public String actionAgreement(@RequestParam(required = false, value = "save") String save,<br /> @RequestParam(required = false, value = "delete") String delete,<br /> @ModelAttribute Agreement agreement, ModelMap modelMap){<br /> if (delete != null) {<br /> loanService.deleteAgreement(agreement);</p><p>addMessage(modelMap, "Collateral Management Agreement has been deleted successfully.", MessageType.success, true);</p><p>return "redirect:?output=body&amp;facilityNumber=" + agreement.getLoan().getFacilityNumber();<br /> }</p><p>if (save != null){</p><p>loanService.saveAgreement(agreement);</p><p>addMessage(modelMap, "Collateral Management Agreement has been saved successfully.", MessageType.success, true);</p><p>return "redirect:?output=body&amp;facilityNumber="+agreement.getLoan().getFacilityNumber()+"&amp;id="+agreement.getId();<br /> }</p><p><br /> addMessage(modelMap, "Failed to do Action on agreement..", MessageType.error, true);</p><p>return "redirect:?output=body&amp;facilityNumber=" + agreement.getLoan().getFacilityNumber();<br /> }</p><p>

 

jsp

</p><p> &lt;form action="&lt;c:url value="/process/agreement/actionAgreement"/&gt;" method="post" id="form-agreement"&gt;</p><p>...</p><p>&lt;div class="row buttons"&gt;<br /> &lt;div class="column8"&gt;<br /> &lt;button type="submit" name="save" value="save"&gt;&lt;span&gt;Save&lt;/span&gt;&lt;/button&gt;<br /> &lt;/div&gt;<br /> &lt;div class="column8" id="btn-delete"&gt;<br /> &lt;button type="submit" name="delete" value="delete"&gt;&lt;span&gt;Delete&lt;/span&gt;&lt;/button&gt;<br /> &lt;/div&gt;<br /> &lt;/div&gt;</p><p>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s