• Post Reply Bookmark Topic Watch Topic
  • New Topic

Keep HTML tag in String  RSS feed

 
Tom Henricksen
Author
Ranch Hand
Posts: 144
5
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that creates a list of Strings that has HTML tags.

Then calls the JSP to display.
In the jsp I do a forEach and display the list contents



The problem is the <BR> become & lt;br& gt; so they are displayed but don't add line break. Is there a way to escape this out so I get a line break? I am using Tomcat 5.5.9 and JSTL 1.1.

Thanks in advance,
Tom

[ December 18, 2005: Message edited by: Tom Henricksen ]
[ December 18, 2005: Message edited by: Tom Henricksen ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you not have a reference for the JSTL handy? There is an attibute on <cut> that will do exactly what you are asking for.

And... why on earth are you adding the HTML markup in the servlet rather in the JSP in the first place? That's rather inside-out.
[ December 18, 2005: Message edited by: Bear Bibeault ]
 
Tom Henricksen
Author
Ranch Hand
Posts: 144
5
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes thanks Bear

<c: o ut value="${list}" escapeXml="false" />

I should have RTFMed... My bad.

The reason I'm doing this, well this is a mock-up. The real system is getting variable length comments from an EJB(calling the db). And I need to add line breaks to keep things well formated so they print out correctly for the user.

Thanks,
Tom
[ December 18, 2005: Message edited by: Tom Henricksen ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!