Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Escaping in JSP-Documents

 
Oliver Rensen
Ranch Hand
Posts: 109
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers,

during my SCWCD-studies I have learned the following:

It is not allowed to use < in JSP-Documents. < must be escaped with
'& l t ;' in XML-pages (without the blanks):

WRONG:
<jsp:scriptlet> boolean b =
application.getIntHeader("counter") < 100;
</jsp:scriptlet>

CORRECT:
<jsp:scriptlet> boolean b =
application.getIntHeader("counter") & l t ; 100;
</jsp:scriptlet>

But I'm not sure whether I can use > in JSP-Documents or not.

Do I must escape > with '& g t ;' as well (without the blanks)?

Regards
Oliver
[ January 04, 2008: Message edited by: Oliver Rensen ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, > must be escaped.

You can also choose to use CDATA:
 
Oliver Rensen
Ranch Hand
Posts: 109
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marc, thank you for the reply.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!