I want to save the HTML file which is generated by the JSP at the server side.

Govind Seshadri


Answer by Alessandro A. Garbagnati Re: I want to save the HTML file which is generated by the JSP at the server side. Well, the best solution for this is on its way. The new Servlets 2.3 specification will add Filtering that could be the perfect solution to your problem.

I had a similar problem a few months ago and I've developed a simple custom tag that 'wrapped' the file to be saved. The tag was reading the requested page throught a <%@ page include...%> (<jsp:include ...> cannot be used) and then using the body content inside the tag, I had access to the full html output.

Another possible solution is throught a URLConnection object.

Answer by Bhupendra Singh Re: Re: I want to save the HTML file which is generated by the JSP at the server side. Can you elaborate on the custom tag used?
Answer by Alessandro A. Garbagnati Re: Re: Re: I want to save the HTML file which is generated by the JSP at the server side. With a custom tag that implements BodyTag, you can control the content of the body. Once you reach the "doEndTag()" method you have all the body of your tag inside the BodyContent object and you can decide whether you want to outut it to the client or not. In this case, the body content can be saved to a file, or converted to other formats, then sent to the user via some file or by email.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact