For some unfathomable reason you are outputting that data from
Java scriptlets in a
JSP. It would have been much simpler to just use a
servlet containing that code. But more to the point, since it's a JSP maybe the container sensibly assumes you're going to use it to output HTML and therefore sets the content type to text/html? At any rate
you should check at the client end to see what content type you are actually getting.