0

我知道这个问题已经发布了很多次,但是每个发布的解决方案都没有解决我的问题,而我的问题是一样的。我有一个 JSP 页面,我想在其中使用 taglib。所以我在其中添加了这一行:

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

我的项目使用 maven 2 运行,所以我在 pom.xml 中也包含了该依赖项:

<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

这是 web.xml 中的行:

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee `enter code here`http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 

现在,这是我尝试的错误:

org.apache.jasper.JasperException: L'uri absolute: http://java.sun.com/jsp/jstl/core无法在 web.xml 文件或与此应用程序一起部署的其他文件 jar 中解析


当我构建项目时,web-inf/lib 中仍然没有任何内容......我做错了什么吗?我的意思是,一旦我在我的上一篇文章中进行了配置,我在我的项目中做了一个“maven build”,它显示在我的屏幕上“build success”,然后我启动 tomcat 并输入我的 asp 的 url 并打印我上面给出的错误...

这是我的整个 pom.xml,因为你告诉我它可能会出错:

<modelVersion>4.0.0</modelVersion>
<groupId>CapG</groupId>
<artifactId>CapG</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
</dependencies>

4

1 回答 1

0

通过 maven获取打包war文件后,请验证jstl-1.2.jar您的目录中是否有所需的WEB-INF/lib文件。如果没有,可能需要在您的pom.xml.

编辑:尝试<packaging>war</packaging>在您的 pom.xml 中添加(在构建之前)。

于 2013-05-19T21:36:20.037 回答