Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] JSP using Java 1.7?

On 11/07/2012 03:21, Jan Bartel wrote:
John,

change webdefaults to add this initParam to the jsp servlet:

     <init-param>
       <param-name>compilerTargetVM</param-name>
       <param-value>1.7</param-value>
     </init-param>

Jan,
Many thanks for this. Googling "compilerTargetVM" took me to your
"Configuring JSP" how-to, and this gave me a few more hints:

  "There are several options for modifying the Jasper JSP servlet
   configuration... Another option is to add an entry for the Jasper
   JSP servlet to the web.xml file of your webapp."

Accordingly I modified web.xml to include the following:

  <servlet id="jsp">
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
      <param-name>compilerTargetVM</param-name>
      <param-value>1.7</param-value>
    </init-param>
    <init-param>
      <param-name>fork</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <param-name>reload-interval</param-name>
      <param-value>-1</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>

... with the usual JSP <servlet-mapping>.

This didn't seem to work. Then I noticed this warning in the how-to:

  "For all of the parameters below, if the value you set doesn't take
   effect, try using all lower case instead of camel case, as JSP is
   inconsistent in its parameter naming strategy."

So I tried "compilertargetvm", and again, no luck. I then tried both
with 7 as the value instead of 1.7, as the error message says "try-
with-resources is not supported in -source 1.5 (use -source 7 or higher
to enable try-with-resources)", and still no luck.

(That error message is amazingly unhelpful, BTW!)

So, I'm still baffled. Is there anything else you can suggest? Any
obvious mistakes I'm making?

TIA,
--
John English




Back to the top