You have several issues, we will start by making a simple ascii generator:
while(char < limit) file.print(char);// char starts at space
That is overly abbreviated, but the first thing we need to do is move away from the char transmission as binary, there are many tools already in place that transmit a great deal of information using regular Strings, doing it as regular internet traffic. We get a PrintWriter or something like it for free in JSP when the page is invoked, we just have to remember to set the header to text/html.
Guess what, it does that by shipping a regular String.
I normally don't smile but I did the smiley to encourage you to do a few steps before getting bogged.