• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Expression Language renders raw text, including HTML

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Helloz,

When using expression value in jsp, if expression includes HTML tags, tags are rendered by container. Say, I have attribute "currentTip" in the session and it contains value " tag make things bolder." (Head First Servlets & Jsp book 2nd edition, pg 283). And when we print it in jsp, by saying .

It shows " tag make things bolder." I could not find solution for how we can avoid this.



Please help..
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like the software ate up some of your post where you are trying to show us the 'b' HTML tags ?

Did you try this



I doubt if I have fully understood your question, but I thought I would reply anyway
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The issue I am asking for just happend in my first post... Now I don't know how can I explain the problem..

Let me try...

I have one session variable, say "currentTip" and

Now I want to print this in JSP, by saying ${currentTip}. It should be printed without rendering that "b" tags. ie. I want to disable HTML rendering for value of expression. how can I do that?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the "c:out" JSTL tag and its "escapeXml" attribute for this: http://www.ibm.com/developerworks/java/library/j-jstl0318/
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its showing "Content Encoding Error" at this url...
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try escaping:
<b> </b>
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vish Shukla wrote:Its showing "Content Encoding Error" at this url...



Did you use c:out or not?? Did you use a taglib directive for the c:out tag?? Show us the complete stack trace of the error...
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think there is a big misunderstanding... sorry for my laziness.. Actually "Content Encoding Error" is shown not for <c:out> but said that for Ulf Dittmer's post.


You can use the "c:out" JSTL tag and its "escapeXml" attribute for this: http://www.ibm.com/developerworks/java/library/j-jstl0318/



I am yet to try <c:out>.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic