You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2002/07/17 17:11:15 UTC

Tomcat and Session And jsp include

Hi,
I am developing an web application using tomcat4.0.4
and apache 2.0.39 on win2000
I want the user the login on the first page, so once
the user logs in i create a session for the user,
now in other jsp in applciation i have a header.jsp 
this jsp checks if the session is active or experied, 
if experied redirect to signin page.
this jsp checks for the session, but some how
response.sendRedirect("index.jsp"); does not work

I have a signoff.jsp which simply invalidates the
session,
now the problem is , some how when i include the
header.jsp in my other jsp, it seems that it does not
redirect to the indexpage if the session is not valid,
and alows the other code to work,so i get null pointer
exception,
but if i only header.jsp it works.

why is that...is there any other way to check if the
session is alive or not,??? 
or any other way to redirect the response???
how do i set session experience time ??? it is 30min
now.
the code for header.jsp is given below 
please help
Ashish

which looks some thing like this

<%@ page language="java" session="true"
import="com.ibm.as400.access.*" buffer="16kb"
autoFlush="true" isThreadSafe="true"
isErrorPage="false" %>

<%
try{
if (session == null)
{
response.sendRedirect("index.jsp?error=2");
}
else
{
AS400 value = (AS400)session.getAttribute("as400");
System.out.println("value of as400 in header.jsp " +
value);
if (value == null)
{
System.out.println("there is no as400 so
response.sednRedirect");
response.sendRedirect("http://pfizer-maps/maps/pages/index.jsp?error=2");
out.println("i am not able to use
response.sendRedirect");
}

}
}
catch(Exception exc)
{
System.out.print("no as400 value in header.jsp");
response.sendRedirect("index.jsp?error=2");
}

%>



__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Check Session is valid & response.sendRedirect not working

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,
I am developing a webapplication with tomcat4.0.4 and
apache 2.0.39,
I want the user to login on first page, and then check
if the session is valid or not in each jsp, and
servlet.
So what is the best way to do it??
i am using jsp code code as below, but seems it that
response.sendRedirect("http://localhost/maps/pages/index.jsp");
does not work.

AS400 value = (AS400)session.getAttribute("as400");
System.out.println("value of as400 change env " +
value);
if (value == null)
{
System.out.println("there is no as400 so
response.sednRedirect");
response.sendRedirect("http://localhost/maps/pages/index.jsp");
System.out.println("i am not able to redirec");
}

this code works on JRun, Blazix, Websphere, Weblogic
so what is the problem
Ashish



__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>