我是JSP新手并使用Expression语言.我正在使用Eclipse Galileo 2.5版和Tomcat 6服务器.我只是想问一下,我的简单表达式语言不会像我写的那样打印${1>2},假设它给出了假,但${1>2}它只在呈现页面时显示 .但是当我使用<c:out value="${1>2}"/>它时,正确打印错误.我认为标签库存在问题.请建议我这样做的原因我给出了一个示例代码,以便您可以了解我的错误: -
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Expression Language Example</title>
</head>
<body>
Is 1 greater than 2 using cout :<c:out value="${1>2}"/>
Is 1 greater than 2 without using cout: ${1>2}
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
根据答案更新,这里有更多信息:
我正在展示我的web.xml样子:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" …Run Code Online (Sandbox Code Playgroud)