spring-webflow
spring-webflow copied to clipboard
Allow Spring MVC Controllers to control which fragment(s) to render for a composite view [SWF-1090]
Keith Donald opened SWF-1090 and commented
Currently it is only possible to specify fragments client-side, which doesn't really mesh with MVC concepts and allows the client to render other views that should not be renderable for a given resource. Web Flow allows for controlling fragment rendering server-side, but Spring JavaScript's MVC integration does not. We should add support for this with Spring MVC.
Specification:
A MVC Controller can return a String viewname in the format [compositeViewName]#[fragment1,fragmentN].
Example:
@RequestMapping
(value="/application/info", method = RequestMethod.POST)
public String processInfoSubmission(PersonalInfo personalInfo, BindingResult errors, AjaxHandler handler, Model model) {
personalInfo.validate(errors);
if (errors.hasErrors()) {
return "application#info";
}
contestantService.saveInfo(personalInfo);
if (handler.isAjaxRequest()) {
model.addAttribute("status", contestantService.getApplicationStatus());
return "application#status";
} else {
return "redirect:/application/info";
}
}
The example above says render the info fragment of the application composite when there are validation errors. Render the status fragment after successful submit and it's an ajax request.
Affects: 2.0.6
Issue Links:
- #480 Add support for "modal:" view prefix
2 votes, 2 watchers