jsp getAttribute返回null
我有这样的问题,当我得到attriubute时,它包含null,但是我分配给它的变量得到了值 以下是我如何通过位置的perviouse页面:jsp getAttribute返回null,jsp,Jsp,我有这样的问题,当我得到attriubute时,它包含null,但是我分配给它的变量得到了值 以下是我如何通过位置的perviouse页面: <%if(rs.next()) {%> <td><a href="university.jsp?location=<%=rs.getInt("cs_id")%>"><%out.print((String) (rs.getString("country_state")));%></a>
<%if(rs.next()) {%>
<td><a href="university.jsp?location=<%=rs.getInt("cs_id")%>"><%out.print((String) (rs.getString("country_state")));%></a></td>
<%}else{ break; } %>
这是未获取参数的页面
请选择您所在的大学州或进入您所在的大学:
<%
//set the session the each parameter
String locationString = request.getParameter("location");
Integer locationId = Integer.valueOf(locationString);
session.setAttribute("locationId",locationString);
System.out.print(locationString);
System.out.print(request.getAttribute("locationId"));
%>
您使用的是
session.setAttribute(“locationId”,locationString)代码>将属性放入会话
但您试图通过request.getAttribute(“locationId”)
request.getAttribute
不同于session.getAttribute