Force JSP page to output CR+LF

K

keith73

We have a JSP page that needs the line breaks to be \r\n instead of
just \n. Pages created in Eclipse on Windows, but when they are moved
into production, IE7 is having a problem with the \n not being a \r\n.
These are being used in a browser based application.

How can I force the JSP page, via Java, JSTL or Velocity, to output
newlines the way we need them too?

thanks.
 
T

Thomas Kellerer

keith73 wrote on 04.04.2007 20:44:
We have a JSP page that needs the line breaks to be \r\n instead of
just \n. Pages created in Eclipse on Windows, but when they are moved
into production, IE7 is having a problem with the \n not being a \r\n.
These are being used in a browser based application.

How can I force the JSP page, via Java, JSTL or Velocity, to output
newlines the way we need them too?

Why would you want to do that?

A JSP page returns HTML to the client.
\n or \r have no meaning in HTML you have to use <br> (or <br/> for XHTML)

Thomas
 
L

Lew

keith73 wrote on 04.04.2007 20:44:
Thomas said:
Why would you want to do that?

A JSP page returns HTML to the client.
\n or \r have no meaning in HTML you have to use <br> (or <br/> for XHTML)

In fact, all whitespace in HTML collapses to a single space in the browser
unless you override with &nbsp; or <pre> or the like.

As Thomas pointed out, using one (normal) whitespace character or another (\r,
\t, \n, ' ', etc.) is not going to create different rendering on the client side.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top