File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to return a string in JSP with HTML tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to return a string in JSP with HTML tags" Watch "How to return a string in JSP with HTML tags" New topic
Author

How to return a string in JSP with HTML tags

Leandro Alves
Greenhorn

Joined: Sep 25, 2013
Posts: 3
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

Joined: Jan 10, 2002
Posts: 60056
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

Perhaps this topic posted yesterday will help you out.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Leandro Alves
Greenhorn

Joined: Sep 25, 2013
Posts: 3
Joe Ess wrote:Perhaps this topic posted yesterday will help you out.


Joe,

Thanks dude!
It solved my problem!
Thanks a lot! =D
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to return a string in JSP with HTML tags
 
Similar Threads
Can getters/setters be seperated from the ActionSupport class with a bean?
Struts 2 internationalization with a dynamic key
get action property
s:radio and display tag
Handling multiple form data in struts2