GWT + JSTL in development mode -- is it possible?
I have a GWT app (generated by roo) that I have decided to secure with Spring Security. Roo generates a login.jspx page as part of the security setup and this jspx uses some basic JSTL taglibs.
When running in development mode, the underpinning Jetty server apparently does not like this. With the following Maven dependencies
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
<classifier/>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<classifier/>
</dependency>
I get
java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
My guess was that the jstl-impl dependency was conflicting with one already provided by the web container, but when I change its scope to provided, I get:
org.apache.jasper.JasperException: /WEB-INF/views/login.jspx(22,69) The attribut开发者_开发百科e prefix fn does not correspond to any imported tag library
Anybody gotten this to work successfully?
P.S. I hear rumors that you can just export the app to Tomcat, and it runs fine, but GWT compilation can be a time consuming operation, so it would be great to get this working in dev mode.
Evidently, the Jetty server underpinning GWT development mode has JSTL 1.1 already on the classpath somewhere. If you change the Maven dependencies that Roo adds by default
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
<classifier/>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<classifier/>
</dependency>
to
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.1</version>
<classifier/>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.1</version>
</dependency>
you will have a working GWT + JSTL environment!
精彩评论