Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Force JSP page to output CR+LF

Thread view: 
keith73 - 04 Apr 2007 19:44 GMT
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.
Thomas Kellerer - 04 Apr 2007 19:50 GMT
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
[quoted text clipped - 3 lines]
> 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
Lew - 04 Apr 2007 23:56 GMT
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
[quoted text clipped - 3 lines]
>> 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)

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.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.