The entity name must immediately follow the '&' in the entity reference

Sureshkumar Menon picture Sureshkumar Menon · Apr 17, 2011 · Viewed 10.3k times · Source

Hi in my jsp page i am testing a condition

<jsp:scriptlet>

  if (session.getAttribute("empid") != null && session.getAttribute("empid") != "")
{
.......
}

But i am getting compiler error.

The entity name must immediately follow the '&' in the entity reference.

any body know how to solve this?

Answer

nfechner picture nfechner · Apr 17, 2011

The answer depends a bit on the type of JSP page you are using.

If you use normal JSP pages, you can choose between replacing your <jsp:scriptlet> tags with <% %> or escaping all XML entities (like & as &amp; or < as &lt;).

However, if you are using JSPX (also called JSP document), your only choice is to escape the XML entities.