I have a custom attribute defined in a HttpSession and I set the attribute from within a library class as follows:
public class changeBeanAttribute {
public changeBeanAttribute()
{
}
public void changeAttribute (HttpServletRequest request) {
request.getSession().setAttribute("CustomAttribute","Sample Attribute Value");
}
}
However, when I attempt to access the modified attribute from a JSP page as follows, I get a null value returned
<% String str = request.getSession().getAttribute("CustomAttribute"); %>
Can someone help me understand why I can't access the HttpSession attribute from the JSP page?
Both the the JSP page and Java class are running in a Tomcat container.