You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Choe <ch...@mindspring.com> on 2000/11/13 17:44:03 UTC

out.write() method

i am writing a web based mail client in jsp.  i have tomcat3.2 running
on a freebsd machine.

i am using java mail package and have managed to connect to the pop
server and get a list of the unread mail.  but when i try to view mail
that is just plain text something strange happens.

the message is just printed out without some return carriages.

example:

 Hi, one more question:) THe PrintWriter class has both write and print
method. THe one i saw in your notes is the print method. What's the
difference between the two methods? thanks, Ge Sun >From: Peter Choe
>To: "GE SUN" >Subject: Re: CIS9771 MW6--SemiColon?? >Date: Mon, 30 Oct 2000 08:18:57 -0500 > >i have found that not using the semicolon works on most databases. the >only thing i can say is >that with the database try it without the semicolon. if you get a >sqlexception, try it with the semicolon. > >but i think that in general you don't need the semicolon because the JDBC >driver should translate the SQL >statement to the appropriate format for the database. > >as for my example, it is a typographical error. it should be: > >stmt.executeUpdate("UPDATE coffee_bean SET price=10.99"+"WHERE bean='FRENCH >ROAST'"); > >peter choe > > >At 10:46 PM 10/29/00 +0000, you wrote: > >>Prof Choe, >>While reading JDBC short course, text book, and your notes for this >>section, i was confused of the use of semicolon inside a query. Some of >>the statements included the semicolon at the end of sql statement, some >>didn't. >>For example: >>1 the one with semicolon: >>ResultSet rs=stmt.executeQuery("SELECT programmer, cups FROM JoltData >>ORDED BY cups DESC;"); >>2. the one without semicolon: >>ResultSet rs=stmt.executeQuery("SELECT * FROM Books"); >>When do we need to include the semicolon, or the semicolon doesn't >>matter??? >> >>My other question is also about the syntax. >>In your JDBC note, you wrote one statement as follows: >>stmt.excuteUpdate("UPDATE coffee_bean SET price=10.99" + WHERE bean= >>"FRENCH ROAST"); >>I thought the "WHERE bean= " should also be quoted since it is a part of >>the sql commend. >>But i don't know how to fix this, should it be: >>stmt. executeUpdate("UPDATE coffee_bean SET >>price=10.99"+ "WHERE bean=\"FRENCH ROAST\""); >>or >>stmt.executeUpdate("UPDATE coffee_bean SET >>price=10.99"+"WHERE bean='FRENCH ROAST'"); >>????? >> >>GE SUN > _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.

but when i view this in a java application and use System.out.println()
to print it is normal.  when i looked at the code in the works
directory, i noticed that the code say out.write() where out is an
object of JasperWriter.  how can i print this message with the correct
line carriages?

peter choe

Re: out.write() method

Posted by Peter Choe <ch...@mindspring.com>.
hey!  that actually worked.  thanks for the tip.

peter choe

CPC Livelink Admin wrote:
> 
> Maybe its that you need to replace "\n" with "<BR>" (Break Line) to get the
> new lines in HTML, since HTML ignores the formatting of the input text.
> (Unless you use the <PRE> tag I think)
> 
> -----Original Message-----
> From: Peter Choe [mailto:choepete@mindspring.com]
> Sent: Monday, November 13, 2000 11:44 AM
> To: tomcat-user@jakarta.apache.org
> Subject: out.write() method
> 
> i am writing a web based mail client in jsp.  i have tomcat3.2 running
> on a freebsd machine.
> 
> i am using java mail package and have managed to connect to the pop
> server and get a list of the unread mail.  but when i try to view mail
> that is just plain text something strange happens.
> 
> the message is just printed out without some return carriages.
> 
> example:
> 
>  Hi, one more question:) THe PrintWriter class has both write and print
> method. THe one i saw in your notes is the print method. What's the
> difference between the two methods? thanks, Ge Sun >From: Peter Choe
> >To: "GE SUN" >Subject: Re: CIS9771 MW6--SemiColon?? >Date: Mon, 30 Oct 2000
> 08:18:57 -0500 > >i have found that not using the semicolon works on most
> databases. the >only thing i can say is >that with the database try it
> without the semicolon. if you get a >sqlexception, try it with the
> semicolon. > >but i think that in general you don't need the semicolon
> because the JDBC >driver should translate the SQL >statement to the
> appropriate format for the database. > >as for my example, it is a
> typographical error. it should be: > >stmt.executeUpdate("UPDATE coffee_bean
> SET price=10.99"+"WHERE bean='FRENCH >ROAST'"); > >peter choe > > >At 10:46
> PM 10/29/00 +0000, you wrote: > >>Prof Choe, >>While reading JDBC short
> course, text book, and your notes for this >>section, i was confused of the
> use of semicolon inside a query. Some of >>the statements included the
> semicolon at the end of sql statement, some >>didn't. >>For example: >>1 the
> one with semicolon: >>ResultSet rs=stmt.executeQuery("SELECT programmer,
> cups FR
> but when i view this in a java application and use System.out.println()
> to print it is normal.  when i looked at the code in the works
> directory, i noticed that the code say out.write() where out is an
> object of JasperWriter.  how can i print this message with the correct
> line carriages?
> 
> peter choe

RE: out.write() method

Posted by CPC Livelink Admin <cp...@fitzpatrick.cc>.

Maybe its that you need to replace "\n" with "<BR>" (Break Line) to get the
new lines in HTML, since HTML ignores the formatting of the input text.
(Unless you use the <PRE> tag I think)

-----Original Message-----
From: Peter Choe [mailto:choepete@mindspring.com]
Sent: Monday, November 13, 2000 11:44 AM
To: tomcat-user@jakarta.apache.org
Subject: out.write() method


i am writing a web based mail client in jsp.  i have tomcat3.2 running
on a freebsd machine.

i am using java mail package and have managed to connect to the pop
server and get a list of the unread mail.  but when i try to view mail
that is just plain text something strange happens.

the message is just printed out without some return carriages.

example:

 Hi, one more question:) THe PrintWriter class has both write and print
method. THe one i saw in your notes is the print method. What's the
difference between the two methods? thanks, Ge Sun >From: Peter Choe
>To: "GE SUN" >Subject: Re: CIS9771 MW6--SemiColon?? >Date: Mon, 30 Oct 2000
08:18:57 -0500 > >i have found that not using the semicolon works on most
databases. the >only thing i can say is >that with the database try it
without the semicolon. if you get a >sqlexception, try it with the
semicolon. > >but i think that in general you don't need the semicolon
because the JDBC >driver should translate the SQL >statement to the
appropriate format for the database. > >as for my example, it is a
typographical error. it should be: > >stmt.executeUpdate("UPDATE coffee_bean
SET price=10.99"+"WHERE bean='FRENCH >ROAST'"); > >peter choe > > >At 10:46
PM 10/29/00 +0000, you wrote: > >>Prof Choe, >>While reading JDBC short
course, text book, and your notes for this >>section, i was confused of the
use of semicolon inside a query. Some of >>the statements included the
semicolon at the end of sql statement, some >>didn't. >>For example: >>1 the
one with semicolon: >>ResultSet rs=stmt.executeQuery("SELECT programmer,
cups FR
but when i view this in a java application and use System.out.println()
to print it is normal.  when i looked at the code in the works
directory, i noticed that the code say out.write() where out is an
object of JasperWriter.  how can i print this message with the correct
line carriages?

peter choe