session

hello buddys,In case of session does not keep the object, how JSP tag. Redirects to the given URL .iam seriousely facing this problem for my own site.
[185 byte] By [reeta2] at [2007-9-26 1:46:15]
# 1
Hi Budy!,Do you mean that once session is timed out redirection is not occuring?
sribk at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
If that's the case check in jsp is session is out!like session == null or !session.invalidate() conditions.. and try to redirect to the page U want
sribk at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
hello sribk thx for reply still iam not getting.. here iam using taglibs in my jsp....help me
reeta2 at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Can you send a part of your code where problem occurs..
sribk at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Hi reeta2,

Here iam giving you some relatedcode. I hope it will help you out .

Code:

For example:

1. Your login (start) page (servlet) saves id 'A' in user's session. E.g.:

session.setAttribute("A", new Object());

2. Your JSP pages looks so:

<%@ taglib uri="taglib.tld" prefix="check" %>

<html>

<!-- object ID is 'A' -->

<check:IfNotDef id="A" redirect="http://www.yoursite.com/login.jsp"/>

Checks session and redirects to the specified URL if the given id is not in the session. Parameters are:

1) id Object ID (attribute name)

2) redirect URL for the redirection

Here iam giving you some

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

<taglib>

<tlibversion>1.1</tlibversion>

<jspversion>1.1</jspversion>

<shortname>IfNotDef</shortname>

<uri>http://yousite/servlets/ifnotdef</uri>

<info>IfNotDef tag</info>

<tag>

<name>IfNotDef</name>

<tagclass>com.cj.ifnot.IfNotDefTag</tagclass>

<bodycontent>empty</bodycontent>

<info>IfNotDef session object</info>

<attribute>

<name>id</name>

<required>true</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

<attribute>

<name>redirect</name>

<required>true</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

</taglib>

Still if you have any problem please post the code.

Regards,

TirumalaRao

Developer TechnicalSupport,

Sun MicroSystem,India.

rao_indts at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
hello rao_indts great example u had given.. thanks alottttttt......
reeta2 at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Hi reeta2, Thanks for your reply. Still if you have any problem pleasepost the code.Regards,TirumalaRao.Developer Technical Support,Sun Microsystems,India
rao_indts at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
Hi reeta2, Thanks for your reply. Still if you have any problem pleasepost the code.Regards,TirumalaRao.Developer Technical Support,Sun Microsystems,India
rao_indts at 2007-6-29 2:43:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...