You are doing a very minor mistake. You have defined the currSession
variable in p1.jsp and using it in p2.jsp. Obviously it will give variable
not defined error since its not defined in p2.jsp. Remember p1.jsp and
p2.jsp are two different files.

Whereas the session variable is a implicit object available in jsp for
session object that is why it is working. Infact in jsp you should always
use the session variable and don't define you own.

-----Original Message-----
From: Roland Dong [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 6:11 PM
To: [EMAIL PROTECTED]
Subject: How to create a session object other than "session"


I am testing a session object so

I created
p1.jsp with the snippets:

....
<%
HttpSession currSession = request.getSession(true)

currSession.setMaxInactiveInterval(3600);
currSession.setAttribute("user", Name); currSession.setAttribute("id", ID);

.......

%>

In P2.jsp

<%
.....
currSession.invalidate(); %>
...
%>


However I got errors:

Undefined variable or class name: currSession currSession.invalidate();

If I change the object name to 'session', then it is ok.

Is session object supposed to last through the session?  Am I missiing
something?  Do I have to use the object name 'session'?

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com


"The information in this e-mail, and any attachment therein, is
confidential and for use by the addressee only. If you are not the
intended recipient, please return the e-mail to the sender and delete
it from your computer. Although The Bank of New York attempts to
sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained
as a result of viruses."

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to