Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to return a string in JSP with HTML tags

 
Leandro Alves
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

First of all I don't know if this topic is a JSP issue or a Struts issue, so if this topic is at the wrong place, please move it to the right one.

I'm trying to make a forum in java Struts 2. But when I create a post/topic with javascript TextEditors they put HTML tags in the string and when I return it from the database to the JSP with <s:property value='text'/> the tags don't disappear.
So I read that I should convert the HTML string to 'text'. To do it I used StringEscapeUtils.





Ex.:

[INPUT]:



[OUTPUT with ${text}]:



[OUTPUT with <s:property value='text'/>]:


What should I do to the text turn into HTML?

Obs.: Sorry for my bad english.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

In the future please post text, not screen shots. Screen shots are not searchable. (For the code, I see you used the code tags; good show!)

I have moved this to the Struts forum for you.
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this topic posted yesterday will help you out.
 
Leandro Alves
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:Perhaps this topic posted yesterday will help you out.


Joe,

Thanks dude!
It solved my problem!
Thanks a lot! =D
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic