Hi all,
Yesterday I downloaded the new Spring 3.1RC to test the just introduced support for flash scoped variables in Spring MVC. Unfortunately I could not make it working...
I have a HTML form containing some checkboxes without spring:forms tags. Something like this:
Before the Flash scope support, my annotated controller looked like:Code:<form action="/deleteaction" method="post"> <input type="checkbox" name="itemId" value="1" /> <input type="checkbox" name="itemId" value="2" /> <input type="submit" name="delete" value="Delete items" /> </form>
Alternatively, I could have used an HttpServletRequest instead of @RequestParam:Code:@RequestMapping(value = "/deleteaction", method = RequestMethod.POST, params={"delete"}) public String deleteItems(@RequestParam(value="itemId", required=false) String itemId[]) {
Both methods were working fine. If I try to add the RedirectAttributes to the method parameters, Spring will throw an exception:Code:@RequestMapping(value = "/deleteaction", method = RequestMethod.POST, params={"delete"}) public String deleteItems(HttpServletRequest request) { String itemIds[] = request.getParameterValues("itemId");
Log:Code:@RequestMapping(value = "/deleteaction", method = RequestMethod.POST, params={"delete"}) public String deleteItems(@RequestParam(value="itemId", required=false) String itemId[], RedirectAttributes redirectAttrs) {
What am I doing wrong? How is it possible to get the RedirectAttribues parameter where to add flash scoped variables?Code:Oct 16, 2011 11:20:37 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/App] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: argument type mismatch] with root cause java.lang.IllegalArgumentException: argument type mismatch
Thanks a lot for every hint
Andrea


Reply With Quote
