Hello all,
I'm new with Spring 3. I'm stuck in the following problem: I cannot map the view to the method with path variable.
My code:
I've got the following debug information:Code:@Controller @RequestMapping(value = "/owner") public class OwnerController { ............ @RequestMapping(value = "/{ownerId}/edit", method=RequestMethod.GET) public ModelAndView edit(@PathVariable("ownerId") String ownerId) { ModelAndView mav = new ModelAndView("edit"); return mav; } ............. }
14:20:36.356 DEBUG DispatcherServlet.java:693 - DispatcherServlet with name 'web' processing GET request for [/Tutorial1/owner/1/edit.html]
...
14:50:03.074 DEBUG InternalResourceView.java:236 - Forwarding to resource [/jsp/owner/1/edit.jsp] in InternalResourceView 'owner/1/edit'
My view resolver configuration:
JSP file is located in the WebContent/jsp/owner/edit.jsp file.Code:<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/jsp/" /> <property name="suffix" value=".jsp" /> </bean>
I create link to that method in the following way (another JSP file):
Code:<table> <c:forEach var="owner" items="${owners}"> <tr> <td>${owner.firstName}</td> <td>${owner.lastName}</td> <td><a href="${owner.id}/edit.html">Edytuj...</a> </tr> </c:forEach> </table>
How can I map this method to the single view, not bothering about {ownerId}?
Thanks in advance for your help,
Best regards.


Reply With Quote
