如何用表达式语言编写此JSP代码<%= session.getAttribute("attributeName") %>
比如${blabla}
忘了说我实际上尝试了${sessionScope.attributeName}
,顺便说一句,属性值是一个字符串,由session.setAttribute("attributeName", "EditSession123");
设置,并检查值是否正确发送,我创建了一个jsp 1.0文件并使用了正在工作的<%= session.getAttribute("attributeName") %>
,但当我使用jsp 2.0时,什么也没有出现。
我开始质疑我的头定义?它是从Eclipse中自动生成的
<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" session="false"/>
<jsp:output doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
omit-xml-declaration="true" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Insert title here</title>
</head>
<body>
hello ${sessionScope.attributeName}
${pageContext.servletContext.serverInfo}
</body>
</html>
</jsp:root>
ops,:S session设置为false,我应该仔细阅读eclipse生成的代码,