Mohan K Reddy wrote:

> Hello:
>
> I have a form which is combination of 4 other forms.I need to store this
> data in a variable until I reach the final page to do a submit to my EJB.The
> Navigation through anyone of these forms is multi-routed, and hence we need
> to display the previously keyed in data.
>
> I tried storing in JNDI Context, it worked fine for a single user, but in a
> multiuser env it failed miserably.Are there any solutions to this problem
> other than using Session or Hidden variables. Note that the Form is a JSP
> and the request is traversed through a Servlet.
>

This is exactly the kind of situation that servlet/JSP sessions are designed to
support.  What difficulties would be caused by using it?

One possible issue that many people have is memory space occupancy.  If that's an
issue for you, one strategy is to go ahead and create sessions for users, but do
not store any data in them -- instead, use the session ID as part of the "unique
key" for this particular user's data stored in the JNDI context.  That way, you can
still use JNDI (presumably storing data in some external data storage like a
directory server or a database).

If you use this strategy, you can add one more trick to clean out all the JNDI
context entries when the session expires.  This is done by, when the session is
created, add a single object that implements the HttpSessionBindingListener
interface -- when it receives the valueUnbound() event at expiration or timeout, it
can clean out all the junk for the now-obsolete session.  (In a servlet 2.3
environment, you will also be able to use application event listeners for this.)

>
> Thanks in advance
>
> Mohan
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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