Reputation: 962
I want to share my sample code in my website. And I used Punctuation marks(such as; &, *, % etc.) in jsp file like below;
<pre>
/*
if(sensB>sensA && diffB>200)
{
ctr++;
delay(2500); // INCREMENT
}
*/
</pre>
But I had got warnings;
Description Resource Path Location Type Invalid character used in text string (/if(sensB>sensA && diffB>200) { ctr++; delay(2500); // INCREMENT }/)
How can I get this error?
Upvotes: 0
Views: 3532
Reputation: 57381
As shi
metntioned in the comment you need to escape your content (code string) in JSP
<c:out value="${myCodeString}"/>
there is another option:
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
${fn:escapeXml(myCodeString)}
Got from How can I escape special HTML characters in JSP?
Upvotes: 1