I have several servlets that check to see if you have done the login
successfully. If not, they create a session and write out the original
URL and redirect you to the login page. The login page upon successful
entry writes to the session indicating login successful and reads the
original URL and redirects them back to where they originally tried to
go. Flow would be as follows:

1. main.html from here click on link that runs Servlet myServlet1.
myServlet1 redirects to login.html

2. login.html enter username and password click Ok button, this
invokes the LoginHandler servlet redirects back to myServlet1.

3. Screen shows html from myServlet1.

The HttpSession object appears to be created (No errors) but when the
login servlet tries to retrieve the original URL it is not there. The
HttpSession seems to work fine if I take out the redirects and change to

1. main.html from here click on link that runs Servlet myServlet1.
myServlet1 returns html page with link to login.html
2. click on link to login.html
3. login.html enter username and password click Ok button, this
invokes the LoginHandler and returns page with link back to myServlet1.
4. clink on link to myServlet1.
5. Screen shows html from myServlet1.

The code with the redirects works fine if I run the servlets from the
Java Web Server from Sun, Netscape Web Server using ServletExec or
JRUN. Below shows an excerpt of the code. I would prefer to use Jaguar
and not have to purchase one of the above products. I am pretty new to
java, am I doing something wrong?


public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
String host = getHost(req);

HttpSession session = null;
if (isPersonLoggedIn(req, res))
session = req.getSession(true);
else
return;
additional code...


public boolean isPersonLoggedIn(HttpServletRequest req,
HttpServletResponse res) throws ServletException, IOException
{
HttpSession session = req.getSession(true);
Object done = session.getValue("login.isDone");
if (done == null)
{
String target = "";
String query = "";
res.setContentType("text/plain");
target = HttpUtils.getRequestURL(req).toString();
query = req.getQueryString();
if (query != null)
target = target + "?" + query;
session.putValue("login.target", target);
res.sendRedirect(getHost(req) + "/login.html");
return false;
}
else
{
return true;
}
}