Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to store arrayList in ServletContext?

844620Mar 28 2011 — edited Mar 29 2011
I want to create a new ServletContext in a servlet.java file that stores items from an arrayList in another servlet file. Then I want to display this list of items in the ServletContext on a JSP page. How can I accomplice this? I tried this for my Servlet to save the items in the context:
                ServletContext application = this.getServletContext();
                String path = application.getRealPath("E:/books.txt");
                application.setAttribute("items", ELoan.getItem(path));
But this does not seem to be working. I am just learning JSP, any clarification would be great.

Thank You
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2011
Added on Mar 28 2011
4 comments
1,006 views