1097733
1097733

Reputation: 477

Issue with s:property tag in struts2, Not showing spaces in text

We are using s:property tag to display string value on struts 2.

<s:property value="stringValue"/>

If "stringValue" has multiple spaces then it is showing only 1 space instead of exact text.

Ex: String stringValue ="Hello  World,  Welcome";
Output: Hello World, Welcome.

Here string text has two space in between but on application it is displaying only 1 space.

I have tried to use escapeHtml as false but same issue.

What is wrong with this tag?

Best Regards, RKG

Upvotes: 0

Views: 745

Answers (1)

Dave Newton
Dave Newton

Reputation: 160191

Nothing is wrong with the tag.

HTML treats multiple whitespaces as a single whitespace; that's just the way HTML is.

If you want to explicitly have multiple spaces you'll need to convert them to &nbsp; entities. There are a zillion ways to do that.

Upvotes: 4

Related Questions