相关疑难解决方法(0)

EL表达式未在JSP中评估

我的servlets/jsp Web应用程序存在一个小问题.我正在尝试在jsp页面中使用jstl.当我使用任何标签时,例如:

<c:out value="${command}"/>
Run Code Online (Sandbox Code Playgroud)

它告诉我

${command} 
Run Code Online (Sandbox Code Playgroud)

在我的浏览器中而不是参数'command'值.我正在使用maven(我猜问题就在这里).这是pom xml依赖项:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.0.1</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>jstl</groupId>
  <artifactId>jstl</artifactId>
  <version>1.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我的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 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
     version="3.0">
Run Code Online (Sandbox Code Playgroud)

和jsp部分:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>

<head>
<title>Parsing results</title>
<link type="text/css" rel="stylesheet" href="css/page.css"/>
<link type="text/css" rel="stylesheet" href="css/table.css"/>
</head>

<body>
<h2 align="center">Results of 
parsing. Parsing method = <c:out value="${command}"/></h2>.......
Run Code Online (Sandbox Code Playgroud)

编辑:设置命令值的代码很简单:

request.setAttribute("command", parser.getName());
Run Code Online (Sandbox Code Playgroud)

然后去

request.getRequestDispatcher(redir).forward(request, response);
Run Code Online (Sandbox Code Playgroud)

请告诉我,我做错了什么!谢谢!

jsp web.xml jstl el

13
推荐指数
1
解决办法
6763
查看次数

标签 统计

el ×1

jsp ×1

jstl ×1

web.xml ×1