Announcement Announcement Module
No announcement yet.
How to show HTML files using Spring MVC Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to show HTML files using Spring MVC

    I need to show html file content in a pop up window depending upon user selection.My application generates many html files and the requirement is to show those files if required.User can select any number of files.

    a.)How can I dynamically show different HTML files to the user since I can configure only one file as success view for a controller ?
    Or probably I do not need to configure any success view ?How should I proceed here?
    b.)Which method should be overridden ?

    Can I override showForm method and take PrintWriter from response and then write HTML string to it?
    But then what should I put in ModelAndView object?
    Last edited by jiteshks; Sep 25th, 2008, 07:42 PM.

  • #2
    Hi jiteshks,

    If HTML files to be shown are static Spring should have nothing to deal with them IMO. In fact static content should be served by a fast web server like Apache rather than a Java Application Server/Servlet Container.

    If the HTML files are however generated (JSP) then you will be playing with ModelAndView for each file. Since each file should be served as part of one request then you can accommodate logic to serve one or the other instantiating different ModelAndView objects.

    Remember to follow conventions for retrieving the files. Avoid configuration as much as possible.

    Best rgerads,