• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Binary Data and JSP

 
Murali Mohan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Murali Mohan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can u pls elaborate ?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic