AbSoLution8
AbSoLution8

Reputation: 1213

HTML Quote Escaping in Struts2 jsp

My current set up is that I save user input in xml format and display it using the <s:property> tag.

Everything works, except when it comes to single quote, double quotes, the data is stored in the xml as

&amp;amp;amp;quot; 

and when I pull it out using the property tag, it was not converted back to the "

How can I overcome this? Is this an issue storing the data or displaying?

Upvotes: 2

Views: 5711

Answers (2)

Umesh Awasthi
Umesh Awasthi

Reputation: 23587

It can be an issue either with the data being stored as well data being displayed by the tag.I suggest you to first check the data being stored in your DB and see if that is getting stored in the way it should, and if this is getting stored properly that it can be an issue with the way property tag displaying it.

Struts2 property tag define some attributes regarding HTML,XML and JS which tell the tag weather to escape them while rendering the data or not,few values are being set as true and few are set as false you need to set them as per your requirement to pass information to tag rendering class.

escape  false   true
escapeCsv   false   false
escapeHtml  false   true
escapeXml   false   false

For better understanding refer to the official documents which describes it in more details Property Tag

Upvotes: 2

MohanaRao SV
MohanaRao SV

Reputation: 1125

Struts2 Property Tag

<s:property value="%{yourValue}" escape="false"/>

Upvotes: 2

Related Questions