Im hoping to restrict access to a servlet object by setting a session
attribute in the valid .jsp and looking for it in the called servlet.
Unfortunately the object doesn't seem to be transferring properly.
Are there issues with using:
<%
HttpSession sessionObj = request.getSession();
sessionObj.setAttribute("something", new Boolean(true));
/*** some code here to call servlet - form or similar **/
%>
in my .jsp and then calling:
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, java.io.IOException
{
HttpSession sessionObj = request.getSession();
Boolean b = (Boolean)sessionObj.getAttribute("something");
}
For some reason I keep turning up a null obj in the servlet. Ive tried
enumerating all the sessionObj and its all turning up null.
This seems pretty straightforward.. what am I doing wrong?