I\'m kinda new to Spring and I\'d like to know how to addOject in RedirectView just like in ModelAndView where I can add objects that can be used in views.
To carry data across a redirect use RedirectAttributes.addFlashAttribute(key, value).
From the doc:
A RedirectAttributes model is empty when the method is called and is never used unless the method returns a redirect view name or a RedirectView.
After the redirect, flash attributes are automatically added to the model of the controller that serves the target URL.
public ModelAndView processData(
@Valid final HostFinancialRequest formBean,
final BindingResult bindingResult,
HttpServletRequest request,
@RequestParam String passbook,
RedirectAttributes redirectAttributes) {
// do work an then setup the redirect attributes
redirectAttributes.addFlashAttribute("key", value);
return new ModelAndView("redirect:/credit" + FORM_URL);
}