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 / First Aid / February 2005

Tip: Looking for answers? Try searching our database.

eclipse and servlets

Thread view: 
Peter Höltschi - 20 Feb 2005 16:59 GMT
Hallo everybody
I'm writting a servlet in eclipse and face the following problem.
Usually in java a convention is, that a String must be between "".
When I write

out.println("<table width="533" border="1">");
(where out is an instance of PrintWriter)

I do get of course an error from eclipse. But Html needs this
characters. What do I need to do to work out this problem?

Thanks
Peter
Sebastian Scheid - 20 Feb 2005 18:16 GMT
"Peter H?ltschi" <phoeltschi@yahoo.com> schrieb im Newsbeitrag
news:cvafl5$vjd$1@news.hispeed.ch...
> Hallo everybody
> I'm writting a servlet in eclipse and face the following problem. Usually
[quoted text clipped - 6 lines]
> I do get of course an error from eclipse. But Html needs this characters.
> What do I need to do to work out this problem?

You can escape certain characters in a string with \.

out.println("<table width=\"533\" border=\"1\">");

should work.
With \ you can also use other special characters like
\t = tab
\n = newline
...

Regards
Sebastian
Steve Horsley - 20 Feb 2005 18:30 GMT
> Hallo everybody
> I'm writting a servlet in eclipse and face the following problem.
[quoted text clipped - 9 lines]
> Thanks
> Peter

You need to escape the quotes inside the string to prevent them
from looking like the end of the string. Use backslash for this
purpose, thusly:

out.println("<table width=\"533\" border=\"1\">");

Steve
Symon - 21 Feb 2005 08:28 GMT
Normally, you should use JSP to output HTML.

Anyway, in java, use backslash to escape special characters :

System.out.println("outputing \"special\" characters");

Symon

> Hallo everybody
> I'm writting a servlet in eclipse and face the following problem.
[quoted text clipped - 9 lines]
> Thanks
> Peter


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.