I presume you need this in your getters/setters?

One hack might be to grab a transient instance member reference to the
request (and thus session) in the reset() method (transient to maintain
serializability). This would only be suitable for request-scoped beans
however and wouldnt be advisable for a session-scoped bean due to the
potential threading issues. You might be able to get around that limitation
by using a transient ThreadLocal variable for the task - but Im not sure if
after forwarding to the view you will still be in the the same thread.

Ive not tried either way myself so cant garauntee it will work as expected!

This is of course a nasty workaround. 'Normally' you wouldnt need access to
the session from a form, so you might want to consider a different way of
implementing your solution that doesnt require the form to access the
session.

-----Original Message-----
From: Bård Arve Evjen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 27 August 2003 14:55
To: [EMAIL PROTECTED]
Subject: How to access a session object from a form class


I need to be able to get a session variable from a form class. How can
access it?

Cheers,
Bard

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


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

Reply via email to