Its probably because the String str is not public, only package
access.  Tomcat should have complianed and printed out the description of
the error message to the web browser.  If you have set up some error pages,
you might want to comment them out until you get the pages compiling.

        Randy


-----Original Message-----
From: David Treves [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 23, 2001 12:24 PM
To: MAILING tomcat
Subject: passing an object using sessions - STRANGE???


Hi there, first allow me to apologize for the complexed description...   :o)

I am trying to pass an object using the HttpSession interface. my object is:

class test
{
    int num = 5;
    String str = "this is the string";
}

I added the instance I created in the first JSP page to the session (
session.setattribute("atr") ), I made sure that session does exist when I
enter the first JSP page. I linked this page to a servlet, created an
instance of the HttpSession and tried to get the str/num of that class:

HttpSession session = request.getSession();
test foo = (test)session.getAttribute("atr");
String lala = foo.str;
out.println("sessionVar: " + lala);

I get an error ("The page cannot be displayed") because of the third line
(when I comment it, the servlet IS found and executed...).

what is wrong???

Thanks in advance!
David Treves.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to