Matt Brown wrote:
>
> hi,
>
> I have a jsp page in which users listen to audio files and provide feedback.
> Multiple files are presented on the same page; users respond to each one
> individually, ie, for each response there is a form. Each time a user
> presses a button, a servlet processes the data and regenerates the page so
> the user can continue. My users like this better than a standard form
> approach where all questions must be answered and a single form with
> multiple data is submitted in a batch.
>
> The problem is that I want to access within the jsp page a list of which
> audio files have been responded to, so this can be indicated to users. I was
> hoping to keep a vector of filenames in a bean and access it from the page
> each time it was displayed, and add filenames to the vector from my servlet
> each time users made a response. However, each time my jsp page is
> regenerated by the servlet using:
>
> RequestDispatcher rd =
> this.getServletContext().getRequestDispatcher("pageneme.jsp");
>       rd .forward(request,response);
>
> a new instantiation of my bean is created and I can never properly build
> this vector. How can I create a persistent object that multiple
> instantiations of my page can access during a given session? Do I have to
> store it in a httpsession object?
> thanks in advance,

Put the bean in session scope (i.e. as a HttpSession attribute) if you
want it to survive multiple requests within one user session.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
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