I spent whole day being stucked at a bug that wasnt really a bug, but is actually born out of my weak understanding of Spring MVC.
Follow the link here: http://www.tutorialspoint.com/spring/spring_mvc_form_handling_example.htm
http://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/
@RequestMapping
It is usually used to write the extended link address.
for eg, @RequestMapping("/welcome") would take care of all links in the server with localhost:8080/welcome/* to localhost:8080/welcome.html
However, in my situation where i am using a portal server,i actually use a
@RequestMapping("VIEW")
and extract the extended link address from
then, getParameter from the HttpServletRequest.protected HttpServletRequest getOriginalServletRequest(PortletRequest request) {HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(request);HttpServletRequest originalServletRequest = PortalUtil.getOriginalServletRequest(httpServletRequest);return originalServletRequest;}
For eg, /non360?actionType=Amend
i will getParameter(actionType), which is Amend!
The next issue is the "command" object.
if you are using form, Spring MVC will only detect the "command" object, and ignore the rest.
No comments:
Post a Comment