caching XML with JSP

Posted on 2007-07-30
Last Modified: 2013-11-24
I am writing a web application which grabs XML over HTTP.  The way I am approaching it is that

1-I get the XML over HTTP
2-parse the XML and process it
3-put the processed data  into an ArrayList (approximately 3000 results per request)
4-Then  display the result on JSP like 10 results per page
what happens that  step 1->4 repeat every time I move to next 10 results. Is there any way that my JSP simply pulls stuff from the Array List and dont have to do the parsing  and prcessing over and over ocz it takes v v long this way . If caching is the answer how do i  do it ?
Question by:mostenscer
    LVL 12

    Expert Comment

    There are multiple ways to handle this.  One way is to cache the list in the application or session object, along with an indication of where you are in the list. Here is where it's described:

    Using JSP Variables to Cache Dynamic Content
    LVL 2

    Author Comment

    I am not looking fwd to something other than JSTL
    LVL 2

    Author Comment

    Correction: i am looking fwd to some thing other than JSTL
    LVL 29

    Accepted Solution

    Just use JSTL's <c:set> tag to store something in the session.

    <c:set var="myXmlVar" scope="session">
    //Stuff goes here

    When you call the arraylist stored in the session, first check if it is empty. If it is empy then retrieve the xml via HTTP. If it is not empty then just use it.
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    java update needs to be set up as msi 1 38
    pre4 challenge 19 75
    Unattended XML settings 4 56
    Books that can get me started on JAVA 2 33
    The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now