aspose file tools*
The moose likes Servlets and the fly likes generate file from .JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "generate file from .JSP" Watch "generate file from .JSP" New topic
Author

generate file from .JSP

Vasilis Karas
Greenhorn

Joined: Mar 16, 2004
Posts: 24
I'm trying to figure out a way that allows me to take the dynamic HTML that gets created with each request to a .JSP and create a text file on the server everytime it is requested
  • A user requests a report (myReport.JSP)
  • Servlet processes the request places a couple items (ArrayLists) in the request Attribute
  • The .JSP (report) dynamically creates certain sections (tables, images..) of the report based on those request Attributes
  • User gets a nice html page to view

  • I want to give the users the option of being able to e-mail the report (JSP) if they so please.
    I think the easiest way is to somehow get a hold of the dynamically created html (JSP), create a text file, and then have the server simply use this file as the content of an e-mail message (code which I already have)..

    any help is appreciated
    [ March 18, 2005: Message edited by: Vasilis Karas ]
    Ben Souther
    Sheriff

    Joined: Dec 11, 2004
    Posts: 13410

    You could catch the output with a filter and write to file there.


    Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    Vasilis Karas
    Greenhorn

    Joined: Mar 16, 2004
    Posts: 24
    how? I've read a bit on filtering but am unsure what I'm exactly capturing?
    I'm guessing my filter mapping would be to .JSP, so that anytime a request is made to my JSP then this filtering would kick in and write the response to a file?
    Ben Souther
    Sheriff

    Joined: Dec 11, 2004
    Posts: 13410

    http://simple.souther.us/capture.war
    is an example of using a filter to capture the output of a JSP and print it to stdout.

    It should be enough to point you in the right direction.

    Googling "HttpResponseWrapper" should give you more information.
    Vasilis Karas
    Greenhorn

    Joined: Mar 16, 2004
    Posts: 24
    much obliged...!!
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: generate file from .JSP
     
    Similar Threads
    Is this possible using JSP?
    about struts
    JavaScript created components do not respond to JavaScript functions.
    Assignment Log Project
    How to pretty print ResultSet in a text table