I need to display following special characters in a table TD (exclude the back slash in between < symbol and forward slash),
1) '/<\/@/test#/$/&/)'
But, the browser is able to display only ‘/
i.e, data is getting truncated.
The above issue occurs only when < and / chars occur contiguously.
That is, following works as there is no succeeding forward slash / after the < symbol
2) '/<@/test#/$/&/)'
I am using java code to escape the other special chars.
I am able to successfully replace < with ampersand lt; but how to replace a forward slash / only when < and / appear together.
Please help me
Sorry, even in this website you cannot see what i need to achieve, hence in Point 1 exclude the back slash (I need to display without the backslash, for ur understanding i have put it). I cannot post images as i am a new user.
Everthing which get sent by JSP is by default treated as HTML by the webbrowser. The
<indicates start of a HTML tag and thus the webbrowser will parse it as such (and eventually fail due to a syntax error).You want to escape those HTML special characters like
<,>,&and".If it is dynamic text, this is best to be done with JSTL
<c:out>tag.Of if you want to set a HTML attribute, the JSTL
fn:escapeXml()function is nicer.