Announcement Announcement Module
Collapse
No announcement yet.
Get the rendered JSP HTML content at server side Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get the rendered JSP HTML content at server side

    I want to convert a JSP page to a PDF. For this I am using a third party library which accepts HTML as input.
    So, on the server side, I have to get the complete HTML which is the result after the JSP is rendered and then pass the same HTML to my third party library.
    I am able to accomplish this by writing a filter, which wraps the response in to byte array output stream. I am able to get the complete HTML of the rendered JSP including the rendering of Tiles. This thing cannot be achieved in a controller or servlet as I need to final HTML output(including tiles, any JSP tags present in the JSP and others)
    But, as per the requirement, I need to get some information from the DB and so I thought interacting with DB from a filter is not a good idea. Can anyone suggest a good place where I can do this instead of a filter?

    I tried accessing the BO or DAO object from the Filter, but as my application using spring dependency injection, I have to invoke the filter also using spring which is not possible and so the BO and DAO and jpaDataAccess object in the DAO canít be auto wired.
    So, instead of getting the complete HTML in filter, Please suggest a good place where and how I can accomplish the same.

  • #2
    Figured it out!!

    We can do a request dispatcher in the normal Spring controller passing a wrapped response.

    We can get the complete HTML from that response object.

    Thanks!

    Comment

    Working...
    X