wood burning stoves 2.0*
The moose likes JSP and the fly likes Binary Data and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Binary Data and JSP" Watch "Binary Data and JSP" New topic
Author

Binary Data and JSP

Murali Mohan
Ranch Hand

Joined: Jun 14, 2001
Posts: 47
Hi all I have a basic doubt. How does Servlets is preferred technology to generate binary data than JSP? Any limitation in JSP?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

JSP technology was designed from the get-go to process text data. Trying to get it to serve binary data is fraught with gotchas and problems that need to be worked around. Why bother when servlets are so easy to code?
You can use a hammer to divide a board in two. But a saw does a much better job.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Murali Mohan
Ranch Hand

Joined: Jun 14, 2001
Posts: 47
Can u pls elaborate ?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
JSP automatically assume you will be sending a character stream. Your JSP page gets a automatic variable "out" that assumes it will be sending characters in some encoding. Sending binary data in a character stream results in garbage. Use a servlet to send binary data, it really is not that hard, I don't know why some people are afraid of servlets.
Bill
 
 
subject: Binary Data and JSP