Results 1 to 5 of 5
  1. #1
    pvn_myne is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default How to handle Byte response in a jsp?

    Hi,

    I need to handle Byte array in a jsp and flush it as a pdf?

    Earlier I used to have this code in Servlet? when I placed the same code in jsp it is displaying Illegal State Exception - Response already committed.

    Can any one advice how to handle byte[] response in a jsp?

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You should run a file servlet to stream file. Don't put Java code in JSPs.

  3. #3
    pvn_myne is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default

    Thanks for the Information. But Is there any other way we can handle this in a JSP even the process is complex?

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    It should not be done in JSPs and so doing it in JSPs should not be discussed at all because it's wrong.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default

    Quote Originally Posted by pvn_myne View Post
    Thanks for the Information. But Is there any other way we can handle this in a JSP even the process is complex?
    As said, don't do it. By the time you get to your code in a JSP it has already started sending data back to the requester. After all, that is the purpose of a JSP...to display stuff.

Similar Threads

  1. how to handle files?
    By sayan751 in forum Advanced Java
    Replies: 5
    Last Post: 06-10-2009, 08:39 PM
  2. handle FileNotFoundException
    By minifish in forum New To Java
    Replies: 13
    Last Post: 11-08-2008, 02:01 AM
  3. [SOLVED] Handle own exception
    By stevemcc in forum New To Java
    Replies: 3
    Last Post: 04-10-2008, 04:55 AM
  4. Better way to handle exceptions
    By javaplus in forum Advanced Java
    Replies: 2
    Last Post: 01-16-2008, 06:47 PM
  5. how to handle exceptions
    By paty in forum Advanced Java
    Replies: 2
    Last Post: 08-05-2007, 04:17 AM

Posting Permissions

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