GWT + JSTL in development mode — is it possible?

回眸只為那壹抹淺笑 提交于 2019-12-02 00:00:02

问题


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 attribute 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.


回答1:


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!



来源:https://stackoverflow.com/questions/7062024/gwt-jstl-in-development-mode-is-it-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!