Java – session.getAttribute() is quoted with ” which must be escaped when used within the value

javajspservletssession

I am setting a attribute to the session as:

HttpSession session = request.getSession();
System.out.println(al);
session.setAttribute("arraylist",al);

The al is the list of Employee object. Also I can see the System.out is printing in the console.
But when I am trying to get the list from jsp as:

<%
List<Employee> employees = (List<Employee>)session.getAttribute( "arraylist" );

for(int i=0;i<employees.size();i++){
  Employee emp = employees.get(i);
  out.println(emp.getFirstName());
  out.println(emp.getLastName());
  out.println(emp.getAddress());
  out.println(emp.getContact());
  out.println(emp.getEmail());
}   
%>

I am getting the error:

Attribute value  (ArrayList<Employee>)session.getAttribute("arraylist") is quoted with " which must be escaped when used within the value

I am using Tomcat 6.0.33. Any information will be very helpful.

Thanks.

Best Answer

Maybe

-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false

helps. Check the more strict quoting rules.

Related Topic