Reputation: 114
i have the problems where when i get the attriubute , it contains null, but the variable i assign to it gets the value
heres is the perviouse page how i pass location:
<%if(rs.next()) {%>
<td><a href="university.jsp?location=<%=rs.getInt("cs_id")%>"><%out.print((String) (rs.getString("country_state")));%></a></td>
<%}else{ break; } %>
here is the page not getting the parameter Please select your University State or Enter your University:
<%
//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"));
%>
Upvotes: 0
Views: 898
Reputation: 3633
You use session.setAttribute("locationId", locationString);
to put attribute to session
but you try to get attribute from request
viarequest.getAttribute("locationId")
request.getAttribute
is different from session.getAttribute
Upvotes: 1