您正在从请求而不是会话中获取。
它应该是
session.getAttribute("MyAttribute")我建议您使用JavaServer
Pages标准标记库或表达语言,而不是
Scriplet使用起来更容易并且更不会出错。
${sessionScope.MyAttribute}要么
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><c:out value="${sessionScope.MyAttribute}" />你可以尝试
${MyAttribute},${sessionScope['MyAttribute']}也是如此。


