【问题标题】:GWT + JSTL in development mode -- is it possible?开发模式下的 GWT + JSTL -- 有可能吗?
【发布时间】:2011-08-15 05:46:59
【问题描述】:

我有一个 GWT 应用程序(由 roo 生成),我决定使用 Spring Security 来保护它。 Roo 生成一个 login.jspx 页面作为安全设置的一部分,这个 jspx 使用一些基本的 JSTL 标签库。

在开发模式下运行时,基础 Jetty 服务器显然不喜欢这样。具有以下 Maven 依赖项

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

我明白了

java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;

我的猜测是 jstl-impl 依赖项与 Web 容器已经提供的依赖项发生冲突,但是当我将其范围更改为提供时,我得到:

org.apache.jasper.JasperException: /WEB-INF/views/login.jspx(22,69) The attribute prefix fn does not correspond to any imported tag library

有人让它成功运行吗?

附:我听说你可以将应用程序导出到 Tomcat,它运行良好,但是 GWT 编译可能是一个耗时的操作,所以让它在开发模式下工作会很棒。

【问题讨论】:

    标签: gwt jetty spring-roo sts-springsourcetoolsuite


    【解决方案1】:

    显然,支持 GWT 开发模式的 Jetty 服务器已经在某个地方的类路径中包含 JSTL 1.1。如果更改 Roo 默认添加的 Maven 依赖项

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

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

    您将拥有一个工作的 GWT + JSTL 环境!

    【讨论】:

    • 谢谢,虽然我收到以下警告:[警告] 下载 jstl:jstl:1.1.1 时此工件已重新定位到 javax.servlet:jstl:1.1.1。因此,这似乎是更准确的组 ID。您的解决方案效果很好,为我节省了大量的悲伤,谢谢!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多