I have a JSP with netbiscuits code in it, I am now removing that netbiscuits code but after removing I am unable to get session from my previous page due to which I am unable to move ahead. I am using struts 1. Please suggest a solution to my problem, I would be grateful. Thanks in advance.
Asked
Active
Viewed 1,502 times
1
-
Without any code, it's impossible to help. The session is an implicit object on *every* JSP page, so it's not because you can't access the session itself. – Dave Newton Oct 06 '11 at 16:17
1 Answers
0
I am not sure about your problem.
Can you explain it little more?
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.
otherwise use like
<% String x=""+session.getAttribute("uname"); %>
<%=x %>
For accessing in java pages
Map session = ActionContext.getContext().getSession();
String uname=""+session.get("uname");

Sarin Jacob Sunny
- 2,138
- 3
- 29
- 61