No, you are not missing an import.
The problem is the JDK version you're using does not support
setAttribute(String, Object).  You have to use putValue(String, Object).

Try
session.putValue( "blnIsLoggedIn", true );

and it will work!



>From: Shawn Zhu <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Sessions in Servlets
>Date: Thu, 26 Apr 2001 17:57:57 -0700
>
>Just define the variable first.
>HttpSession Session;
>
>then use it.
>
> > -----Original Message-----
> > From: drew w [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 26, 2001 3:46 PM
> > To: [EMAIL PROTECTED]
> > Subject: Sessions in Servlets
> >
> >
> > I can access sessions in JSP. But I can't seem to write or
> > read them in my
> > servlet. Is this possible. Here is the code:
> >
> > session.setAttribute( "blnIsLoggedIn", true );
> >
> > Error:
> > Undefined variable or class name.
> >
> > I am importing:
> > import java.io.*;
> > import java.util.*;
> > import javax.servlet.*;
> >
> > I also tried import javax.servlet.http.HttpServlet; and I get the same
> > error. Am I missing an import?
> >
> > thanks,
> > andrew
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com
> >
> > ==============================================================
> > =============
> > 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://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>===========================================================================
>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://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

===========================================================================
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://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to