"Radhakrishnan, Sanjay (c)" wrote:
> Craig,
>
> I really appreciate your inputs. I fully agree with your comments as
> to not storing resultsets in session beans. I was just trying to understand
> how sessionbeans are made persistent,Infact I was planning to use some other
> Java Object similar to the CachedRowSet from JavaSoft and store that in my
> session bean. I am happy that thats the recommended approach.
>
> One more question: What would i have to do in order to destroy a
> session bean in the middle of a session. That sounds like an Oxymoron
> doesn't it.
>
Not really ... sometimes you have to destroy things to create new ones :-). The
answer comes from the servlet API specification:
To remove a bean from session context, execute the following code (in a servlet,
or inside a scriptlet in a JSP page):
session.removeValue("id"); // Servlet API 2.0 or 2.1
or
session.removeAttribute("id"); // Servlet API 2.2
where "id" is the value you used in the "id" attribute of the <jsp:useBean>
element.
You can also invalidate the entire session (for example, when your user selects
a "log off" option):
session.invalidate();
which will cause all the user data objects to be removed, and the current
session ID will no longer be valid -- the next request from this user will cause
the creation of a new session.
If your session bean implements the HttpSessionBindingListener interface, it
will also be notified when it is added to, or removed from, a session. See the
servlet spec for more.
>
> Thanks for your time
> Sanjay
>
Craig
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html