Results 1 to 2 of 2

Thread: [RESOLVED] JSP + xls output

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Resolved [RESOLVED] JSP + xls output

    Hi

    Got a weird one here. Probably just me though.

    Work has a button to take data from a db and put it into an xls file using javas jxl.
    Now, it works but is generating an underlying error about the response object already being called.

    So thinking how to fix it I try giving it the out variable defined for the stream, but as it not a pure output stream but a jsp response http stream, java complains. I tried a cast on it but apparently the objects are incompatible.

    I think that the work place doesnt want to create a file just to read and send it when it should be fairly easy to put into the response stream (changing headers etc) to output directly, but I cannot see how.

    Is it possible to have a n output stream object that sits in memory until I want it, or can I trick java into thinking an array or memory space is the stream to hold it? or is there a simple way to feed the output stream into the response outputstream ?

    Any suggestions?

    Regards

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: JSP + xls output

    Hi

    Just an update.

    I had to put the jxl output into a bytearrayoutput (so it would continue working) then feed this into the http output stream via a new string wrapped around the bytearray.toByteArray using the encoding java.nio.charset.StandardCharsets.ISO_8859_1 to get the out stream to open correctly in excel.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width