Usually for accessing session in jsp pages we use the code with in scriptlets like
String x=(String)session.getAttribute("uname");
Type casting is required. or use
String x=""+session.getAttribute("uname");
If you want to print it somewhere in the jsp page do,
<%= session.getAttribute("uname")%>
It will print the session value in jsp page.
For accessing in java pages
Map session = ActionContext.getContext().getSession();
String uname=""+session.get("uname");
No comments:
Post a Comment