Reputation: 305
The following code is not working correctly. I would like to take the following Java String from the bean
String statusMsg = "Hello World! <br/><br/><h3>Test</h3>"
And output it with the HTML tags not escaped.
<s:property escapeHtml="false" value="bean.statusMsg"
The result of this property Tag and String, is that the HTML tags are still being escaped, am I missing something?
My goal is to eventually build a table of status data and output it on the page is this the wrong way to use the property tag? Thank you in advance for your help.
The current output is the following
Hello World! <br/><br/><h3>Test</h3>
I would like it to use the tags and add a couple of new lines and make Test a header. This is all test code right now, just trying to get it to work.
Upvotes: 5
Views: 24473
Reputation: 23587
Can you try something like
<s:property escape="false" value="bean.statusMsg"/>
As per my knowledge If you use the usual Struts property element for displaying data, it will escape html code. Hence, you have to turn off escaping:
Here are more details
Update
I tried the property and its working perfectly either way. i tried it in two way create a property in my Action class and also created a bean and the same property inside that bean
than i used the escapeHtml and it worked perfectly in both cases. Additionally if you want to display data and show it in formatted way i am doubtful this is the right way to do this. My suggestion is better use some CSS/HTML in your JSP to format the output rather than taking help from the property tag
To look in to the issue provide the code of your action and JSP classes.
Upvotes: 8