Hi All,

Is there a way to create a HTML file generated in browser in a JSP file?
This same JSP file parsed by server and show up in a browser in HTML form
and also save this HTML form to a HTML file on the server.

The only way I can think of is using a StringBuffer to append all the HTML form data
and save to a file at the end of the JSP file?

Something like

StringBuffer htmlBuffer = new StringBuffer();
<table width=100%>
  <td>Test This Data</td>
   htmlBuffer.append<"\n<table width=100%>")
   .append("\n<td>Test This Data</td>")

And eventually save this StringBuffer to a file.

I was wondering if there is any easier way.
I'd really appreciate it if anyone can shed some light.

thanks in advance.


JSPs are meant for creating static HTML pages with dynamic content. So you don't need StringBuffer.append(?).. All you need is calling JSP tags and scriptlets and saving the file with .jsp extn.

You can directly write html code in a jsp file.JSP out object is use for that purpose .


Even if you do write code that create a file with the .jsp extension and save it at the server, what would be its use. You would still need to call it and display it to browser.
Even if you create a dynamic link based on the name of the .jsp file that you programaticaly created there is no practical use for such technique.

What are you trying to accomplish?