I am new to Spring framework and created controller using method
@RequestMapping("/fetch/{contactId}") public String getContact(@PathVariable("contactId") Long contactId, Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) { Contact contact = contactService.get(contactId); map.put("contact", contact); return "contact"; }
This extraction method is called to get contact information when the user clicks a link to jsp
<td><a href="fetch/${contact.id}" class="edit">Edit</a></td>
Then it successfully returns the contact object and displays on the user's screen for editing and saving. My jsp form tag is as follows
<form:form method="post" action="add.html" commandName="contact" id="contact" onsubmit="return validateContact(this)">
Now the problem is that when I try to send the page to another method in the same controller, the URL changes to
/myapp/app/contacts/fetch/add.html
then how should it be
/myapp/app/contacts/add.html
I know that there is something that I am not doing right, but what exactly I cannot understand. Evaluate if any of you can help me solve the problem.
Thanks aa
source share