81,092
社区成员
发帖
与我相关
我的任务
分享
--- ${sessionScope.userId}---
<%
//如果UserId 可以取到,strId 应该可以取到
String strId = (String)session.getAttribute("userId");
out.print(strId);
%>
<c:set var="myid" value="${sessionScope.userId}" scope="page"/>
${sessionScope.userId}---
<c:set var="myid" value="${sessionScope.userId}" scope="session"/>
<%
String strId = (String)session.getAttribute("myid");
out.print(strId);
%>
如果想用
String strId = (String)pageContext.findAttribute("myid");
取值, 那么就应该这么写
String strId = (String)pageContext.findAttribute("myid");
String strId =session.getAttribute("userId");
<td>${sessionScope.userId}</td> //这句能正常打印值
<c:set var="myid" value="${sessionScope.userId}" scope="session"/>
<%
String strId = (String)pageContext.findAttribute("userId");
//下面使用strId....
%>