Netbeans will not consider JSP as source level 7

I try to run the .jsp page that I made and continue to encounter this error:

Exception Report Type

message Internal server error

Description The server detected an internal error that prevented it from completing this request.

exceptions

org.apache.jasper.JasperException: PWC6033: error compiling Javac for JSP

PWC6197: an error occurred at line: 27 in the jsp: /Drupalcheck.jsp file PWC6199: Servlet generated error: diamond operator is not supported in source 1.5 (use source operator 7 or higher to enable the diamond operator)

note Full tracking of the exception stack and its root causes is available in GlassFish Server Open Source Edition 4.0 logs.

The problem is that I have no idea why I get it. I have the JDK installed in 1.7 in the section "Libraries and the source / binary format" installed in JDK 7 from sources.

I use Netbeans as my IDE.

I did everything to reinstall Java to reinstall Netbeans, and I haven’t gone anywhere.

+4
source share
1 answer

In my opinion, this has nothing to do with Netbeans, but rather with the application server. It is suspected that you are using Glassfish or Tomcat as they are bundled with Netbeans 7.

I had a problem with Apache Tomcat , and it came down to the fact that Tomcat (the Apache Jasper library) uses Java 1.6 to compile JSP by default . You will have to change the default configuration for the JSP servlet in web.xml . I added the following lines to the web.xml application, note two parameters compilerSourceVM and compilerTargetVM :

 <!-- Jasper JSP configuration --> <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>fork</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>xpoweredBy</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>compilerSourceVM</param-name> <param-value>1.7</param-value> </init-param> <init-param> <param-name>compilerTargetVM</param-name> <param-value>1.7</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet> <!-- The mappings for the JSP servlet --> <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>*.jsp</url-pattern> <url-pattern>*.jspx</url-pattern> </servlet-mapping> 
+11
source

Source: https://habr.com/ru/post/899344/


All Articles