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