Search code examples
servletsspring-mvcjstljsp-tagsdwr

Rendering JSP Custom Tag using DWR with Spring MVC


I have a Spring MVC based web application. There are many custom tags written to make scriptless code. All these tags are rendered when enclosing jsp pages are called.

Now I have a requirement where a portion of a page is to be updated asynchronously. I have been using DWR for asynchronous requests. I want to reuse some of the custom tags and render them using DWR.

Can anyone please validate if this is the right approach?

If the approach is right, can anyone please tell me how can we achieve the same?

Thanks, Amit Patel


Solution

  • Here are the steps how I implemented.

    1. Add required tags in a jsp [havingTag.jsp]
    2. Give logical view name to this jsp. [logicalViewName]
    3. Map DWR request to the controller method [@RequestMapping(value="price-includes", method = RequestMethod.POST)]
    4. return view name which maps to the jsp file having tags[ return "logicalViewName" ]

    I would appreciate if there a better way of achieving this.

    Thanks.