I have JSF 1.2 based Servlet
. Am setting Session
attributes in bean of my Servlet
. Bean is in Request scope. In this Servlet
there is a link. When this link is clicked it calls another Servlet
. This 2nd Servlet is not JSF based. It just contains one JSP page to display data. Am trying to display data in this JSP by retrieving Session
attributes set in the 1st Servlet
. But, the data that am getting in JSP page is null
. Session ID is same in both the Servlets. I have below relevant code in my JSP page.
<%@page language="java" session="true" %>
<%@page session="true" %>
session = request.getSession();
String userName = (String)session.getAttribute("uname");
Below is the way am setting Session attributes in bean
HttpSession session = null;
HttpServletRequest req = null;
req = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
session = req.getSession();
session.setAttribute("uname", this.uname);