简体   繁体   中英

How can i use taglib in JSP page

I know this problem has been posted many times but every solutions that have been posted didn't solve my problem whereas my issue is the same. I have a JSP page and i want to use taglib in. So i added this line in it :

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

My project runs with maven 2 so i included in pom.xml that dependency too :

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

Here is the line which in the 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"> 

And now, here is the error i Get whatever i try :

org.apache.jasper.JasperException: L'uri absolute: http://java.sun.com/jsp/jstl/core cannot be resolved in the file web.xml or in the others files jar deployed with this application


When I build the project, there is still nothing in web-inf/lib... Am I doing something wrong ? I mean, once i have the configuration i put in my last post, i do on my project a "maven build", it displays on my screen "build success", then i launch tomcat and enter the url of my asp and it prints the error i gave above...

Here is my entire pom.xml given that you told me somethind could go wrong with it:

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

Once you get your packaged war file through maven verify that you have the required jstl-1.2.jar in your WEB-INF/lib directory. If not, perhaps something needs to be fixed in your pom.xml .

EDIT : Try adding <packaging>war</packaging> (before build) in your pom.xml.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM