Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1090

Allow Spring MVC Controllers to control which fragment(s) to render for a composite view

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.6
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              jeremyg484 Jeremy Grelle
              kdonald Keith Donald
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: