tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Moreno <>
Subject RE: My parameters are lost when storing them in HttpSession using Servlet
Date Fri, 14 Jul 2000 12:56:59 GMT
If cookies are not supported, you should tried encoding your URLs with the
encodeURL() method of the HttpServletResponse interface.
I hope this helps.

 -----Original Message-----
From: Andrew Shiels []
Sent: Friday, July 14, 2000 3:12 AM
Subject: My parameters are lost when storing them in HttpSession using

I have a servlet which verifies user login information in a database. If the
user is allowed to login I add some information to the session object and
redirect the user to a start page:
public void doGet (HttpServletRequest req, HttpServletResponse res)
           throws ServletException, IOException
  HttpSession session = req.getSession(true);
  session.setAttribute("loggedIn",  new String("true"));
  session.setAttribute("permission",  new Integer(iPermission));
My problem is that when I try and access this session information in my
"index.jsp" page, all values are null.
<%@ page errorPage = "Error.jsp" import = "java.util.*,
javax.servlet.http.*, javax.servlet.*" %>

I have no idea what the problem is, and have stripped my code right down to
the bare bones to see if I am making any stupid mistake. 
Also, I have tested the following with  2 jsp pages, where 1 jsp page stores
data in the session, then redirects to another page where the data is
printed. The files are as follows:
<%session.setAttribute("andy", new String ("HELLO!"));%>
<% response.sendRedirect ("w.jsp");%>
This works fine, so my problem only seems related to servlets. 
Has anyone any idea on what could possible be causing the problem?
Andy Shiels

View raw message