Sorry for some confusion caused if I asked you to put a hash table in the session, it should be a array of int, and recast back to array after you get it from the session.
[EMAIL PROTECTED] wrote:

what ever it is, it worked! I remember doing this before however with no cast necessary?





David Kavanagh <[EMAIL PROTECTED]>
21-11-2002 12:07
Please respond to "Tomcat Users List"


To: Tomcat Users List <[EMAIL PROTECTED]>
cc: Subject: Re: hashtable


I think another lister posted this answer. You should do this;

int styles[] = (int [])session.getAttribute("styles");

I'll also recommend testing the session before using it. I think if you get null from request.getSession(false), that means it timed out, or was marked invalid.

David

On 11/20/2002 11:02 PM, [EMAIL PROTECTED] wrote:


Great,

I have styles which is an int array (to become hashtable) and want to retrieve it from another page (you assume correctly).

I have: session.setAttribute("styles", styles); which runs OK

and: session.getAttribute("styles", styles); which is throwing a compiler

error.

It's been a while since I used session. Just reading the API,
getAttribute
takes a single parameter? With adjustment:
int styles[] = session.getAttribute("styles");
I get another compiler error. What am I doing wrong?

Thanks

Paul.





Paul,
I assume you are asking if you can store something in a session to share between pages. Yes, you can store an object (such as a Hashtable) in the session object. You can use session.setAttribute(key, value) or session.getAttribute() to retrieve it.

David

On 11/20/2002 10:31 PM, [EMAIL PROTECTED] wrote:


Hello,
Can anyone tell me, can a hash table be defined as a session and retrieved from another page as can an array?

Thanks

Paul.


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>










--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to