Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in SOP

 
Olly Ontario
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!
I am trying to read the following line from a text file and print in on an HTML page in a J2EE app:

<applet code=Test.class age=33 width=100 height=100>

but I am not getting proper string output.
I want to print it as a string.
I have tried all possible escape sequences.
Is there any escape sequence for the ">" and "<" characters.

Please help.
Olly
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using &lt; for the less than (lt) sign, and &gt; for the greater than (gt) sign.

General hint: Search for "html escape."
 
Olly Ontario
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the hint Marc.
I'm on it. Will let you know Asap.

Rgds,
Olly
 
Olly Ontario
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well!
I tried <applet code=Test.class age=33 width=100 height=100>

but it printed <applet code=Test.class age=33 width=100 height=100>

dont know why < does not work and > works?

PLease help

Olly
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you have "lt" between an ampersand and a semicolon?

&lt;
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
< marks the beginning of a new HTML element. If you try to print that line directly, it will get printed as an HTML applet element inside the HTML, not the string you want.

You need to use &lt;, with the trailing ;
 
Olly Ontario
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awwww!
Opps!
Sorry! I wasnt using the trailing ;.
Thanks for all your help Marc & Rob.

Rgds,
Olly
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic