Announcement Announcement Module
Collapse
No announcement yet.
Passing the model Map as Xslt stylesheet parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing the model Map as Xslt stylesheet parameters

    Hi,

    I am implementing the AbstractXsltView class.

    In the Spring Doc sec 13.5.1.3.1 - "Adding stylesheet parameters"
    http://www.springframework.org/docs/...lt-subclassing
    it is stated that if I want to pass parameters to a XSLT stylesheets I should override the getParameters() or getParameters(HttpServletRequest request).

    I have a bunch of name/value pairs I want to pass to the XSLT stylesheet. How do I do this when they are located in the model Map passed by the controller class. ?


    Peter

  • #2
    you could add a map of parameters to the request as a request attribute in your controller..
    Code:
    Map paramMap = new HashMap();
    paramMap.put("myParam", "someValue");
    request.setAttribute("paramMap", paramMap);
    ..then override getParameters(HttpServletRequest) like so in your extended AbstractXsltView class;
    Code:
    protected Map getParameters(HttpServletRequest request) {
      return (Map) request.getAttribute("paramMap");
    }
    Regards,

    Comment

    Working...
    X