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.