I have a controller with a method that processes incoming data GET, stores some things in model, and then redirects to another page that deals with these objects.
I cannot find a good way to return the object stored in the first method back from the model to use it in the second method. How can i do this?
Here's the top of the controller:
@Controller
@RequestMapping("/reviews")
@SessionAttributes({"review", "externalReview"})
public class ReviewController {
}
Here is the code that adds the objects that I am after the model:
@RequestMapping(value="/new", params="UName", method=RequestMethod.GET)
public String newFormFromExternal(@ModelAttribute("externalReview") ExternalReview externalReview, Model model) throws IncompleteExternalException {
Review fromExternal = ExternalReviewUtil.reviewFromExternalReview(externalReview, externalDAO);
model.addAttribute("externalReview", externalReview);
model.addAttribute("review", fromExternal);
return "redirect:/reviews/newFromExternal";
}
source
share