JSTL 标签不起作用

JSTL tag is not work

我有一个 JSTL 页面,我想打印一个值。这是我的 jstl 页面

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

<html>
<head>
<title>Application</title>
</head>

<body>
<c:if test="${parameter!=null}">
    <br>
        <label><c:out value="${parameter}" /></label>
    </c:if>
</body>

问题是我没有阅读页面中的任何内容,因为代码未打印。这是我的 pom.xml

<dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>

Servlet

String parameter="hello";

request.setAttribute("parameter", parameter);
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
            dispatcher.forward(request, response);

这是 index.jsp 在我的项目中的位置:

-src
  -main
     -java
     -resources
     -webapp
        -WEB-INF
           -web.xml
        -index.jsp

谁能帮帮我?

还要确保您在 jsp 文件中添加了以下内容:-

<%@ page isELIgnored="false" %> 

EL 表达式:

<c:out value="${requestScope.parameter}"/>