spring - Flash Attributes are not working -
i have got spring mvc project (appfuse) , flash attributes not transmitted request.
what do: in transmitter method:
@requestmapping(method = requestmethod.post) public string onsubmit(entity entity, bindingresult errors, httpservletrequest request, httpservletresponse response, redirectattributes ra){ ... ra.addflashattribute("id", entity.getid().tostring()); success = "redirect:somepage"; ... return success; }
in receiver method, cannot passed flash attribute. tried these approaches:
- by modelmap
- by model
- by @modelattribute("id")
the issue in redirecting string. working 1 is:
success = "redirect:/somepage";
more correct solution is:
success = "redirect:" + request.getcontextpath() + "/somepage";
double slash redirect non-working:
success = "redirect://somepage";
Comments
Post a Comment