You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mighty Tornado <mi...@gmail.com> on 2009/03/18 17:32:34 UTC

Newline doesn't work

Silly question.
I wrote a servlet that gets init params from the web.xml and stuffs them
into the request which is the displayed by JSP.

But when I try to make it a string with newline characters it still prints
everything in one line - like newline characters turn into regular space
characters.

This is the code:

String newline = System.getProperty("line.separator");

String rName = getServletConfig().getInitParameter("rName");

String kName = getServletConfig().getInitParameter("kName");

result += "Family Members" + newline;

result += rName + newline;

result += kName + newline;


I tried "\n", and '\n' as well.


Thanks.

Re: Newline doesn't work

Posted by André Warnier <aw...@ice-sa.com>.
Mighty Tornado wrote:
> Thank you all. The answers were very valuable and I got the thing to work.
> 
You don't seem to realise how nice they all were.  I tell you, no 
technical issue is too complex for these guys.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newline doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
Thank you all. The answers were very valuable and I got the thing to work.

On Wed, Mar 18, 2009 at 1:41 PM, Ilya Kazakevich
<ka...@devexperts.com>wrote:

> Mighty,
>
> Here is good and small HTML tutorial, which I advice you to read:
> http://www.w3schools.com/html/default.asp
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Wednesday, March 18, 2009 7:41 PM
> To: Tomcat Users List
> Subject: RE: Newline doesn't work
>
> > From: Mighty Tornado [mailto:mighty.tornado@gmail.com]
> > Subject: Newline doesn't work
> >
> > But when I try to make it a string with newline characters it still
> > prints everything in one line - like newline characters turn into
> > regular space characters.
>
> That's the way HTML works.  You need to separate lines by <p> or <br>;
> experiment with both to see which is more to your liking.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: Newline doesn't work

Posted by Ilya Kazakevich <ka...@devexperts.com>.
Mighty, 

Here is good and small HTML tutorial, which I advice you to read:
http://www.w3schools.com/html/default.asp
 
-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Wednesday, March 18, 2009 7:41 PM
To: Tomcat Users List
Subject: RE: Newline doesn't work

> From: Mighty Tornado [mailto:mighty.tornado@gmail.com]
> Subject: Newline doesn't work
> 
> But when I try to make it a string with newline characters it still 
> prints everything in one line - like newline characters turn into 
> regular space characters.

That's the way HTML works.  You need to separate lines by <p> or <br>;
experiment with both to see which is more to your liking.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Newline doesn't work

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mighty Tornado [mailto:mighty.tornado@gmail.com] 
> Subject: Newline doesn't work
> 
> But when I try to make it a string with newline characters it 
> still prints everything in one line - like newline characters 
> turn into regular space characters.

That's the way HTML works.  You need to separate lines by <p> or <br>; experiment with both to see which is more to your liking.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newline doesn't work

Posted by Timothy J Schumacher <Ti...@Colorado.EDU>.
Try

If this is going to be displayed by a browser then try:

String newline = "<br>";

-Tim

Mighty Tornado wrote:
> Silly question.
> I wrote a servlet that gets init params from the web.xml and stuffs them
> into the request which is the displayed by JSP.
>
> But when I try to make it a string with newline characters it still prints
> everything in one line - like newline characters turn into regular space
> characters.
>
> This is the code:
>
> String newline = System.getProperty("line.separator");
>
> String rName = getServletConfig().getInitParameter("rName");
>
> String kName = getServletConfig().getInitParameter("kName");
>
> result += "Family Members" + newline;
>
> result += rName + newline;
>
> result += kName + newline;
>
>
> I tried "\n", and '\n' as well.
>
>
> Thanks.
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org