org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 12 in the jsp file: /disp.jsp
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum constants are permitted
11: String s=(String)request.getAttribute("null");
13: case "true":
14: out.println("Cool new session");
The default Tomcat JSP compiler will compile to Java 1.6. As such you can't use Strings in a switch statement which is a Java 7 feature.
Check out the Tomcat documentation for how to specify which compiler is used for JSP pages.
Of particular interest should be the parameters for
Setting compilerTargetVM to 1.7 should allow the page to compile as is.
However the better solution as already mentioned is not to use scriptlets in your JSP page.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Make your JSp compatible with Java 7 standards.