将JSTL添加到jsp(Tomcat 8) [英] Adding JSTL to jsp (Tomcat 8)

查看:175
本文介绍了将JSTL添加到jsp(Tomcat 8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的jsp中使用JSTL库.现在,我遵循了一个教程,它告诉我将此行添加到jsp页面:

I want to use the JSTL library in my jsp's. Now I followed a tutorial and it told me to add this line to the jsp page:

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

它给我的错误是无法使用uri和URL解析taglib.

It gives me the error cannot resolve taglib with uri and then the URL.

我正在运行tomcat8.我的web.xml是这样的:

I'm running tomcat 8. My web.xml is like this:

<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

有人知道如何解决此问题吗?

Does someone know how to fix this?

推荐答案

您需要在类路径中为jstl库添加jar.如果您使用的是maven,则添加此依赖项.

You need to add jar for the jstl library in your classpath. If you are using maven, then add this dependency.

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

将此添加到您的pom.xml.

Add this to your pom.xml.

这篇关于将JSTL添加到jsp(Tomcat 8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆