0

My jsp page not showing "&" I have one string and i am fetching value from backend side. nameStringis coming from backend side as "Orders & Links". But on jsp its showing only Orders.. I want to fetch the full name on jsp as well . Follwing code snippet

      <s:label name="Display Name *" class="bold"/>
      <s:text name="nameString" id="displayName" value="${mrudAction.nameString}"
              class="auto-adjust check-empty"/>
A.G
  • 489
  • 1
  • 6
  • 17

2 Answers2

1

& is a special HTML character. What ever tag library you are using - see if there is an attribute you can add to the text tag to escape HTML.

You could also store the string as Orders &amp; Links

If your using Struts you could also see if the property tag makes sense https://struts.apache.org/docs/property.html

See: https://www.w3schools.com/html/html_entities.asp and How can I escape special HTML characters in JSP?

Allan
  • 2,889
  • 2
  • 27
  • 38
1

text tag is used to pull message from resource bundle. you would be using property tag and use escapeHtml parameters of property tag.

<s:propety  value="${mrudAction.nameString}"  escapeHtml="true" >
want2learn
  • 2,471
  • 2
  • 20
  • 37