It is a jvm level thing. I have a cache that is instantiated at app startup.
It works in a shared hosting environment too becuz each app runs it's own
classLoader. When the app needs to lookup data it looks in the cache first
under a key that is determined by you (usually a unique id that is produced
by a combination of lookup parameters). If the key is there then it pulls
the cached results(A Bean List) from it. It sounds like you may need
something that is more like a persistence layer. Are you caching recordsets
or Lists?

Brandon Goodin
Phase Web and Multimedia
P(406)862-2245
F(406)862-0354
http://www.phase.ws

-----Original Message-----
From: Chen, Dean (Zhun) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 01, 2002 10:19 AM
To: 'Struts Users Mailing List'
Subject: RE: pagination & session scope issue


When u cache it, do you cache it in session scope or in application scope?
If you cache it in application scope, how does each form know which cache to
use.
I don't have a problem paginating... but the combination of session scope &
pagination is a problem.

Thanks

Dean Chen


-----Original Message-----
From: Brandon Goodin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 01, 2002 12:06 PM
To: Struts Users Mailing List
Subject: RE: pagination & session scope issue


if your data doesn't need to be live all the time... cache it and set an
appropriate timeout. I wrote a simple caching mechanism that works great.

This will reduce database lookups then you can create your pagination on the
backend with Some classes.

I have a set of classes i called Scroller,ScrollerBean, and
ScrollerPageBean.

The Scroller handles the splitting up of the List according to the page size
specified and the size of the list passed and handles all the logic for
determing the values that are stored in the ScrollerBean and
ScrollerPageBean. The ScrollerBean holds all the values for the actual List,
pageNumberList, next, nextPage, previous, previousPage, resultSize, etc. The
ScrollerPageBean holds data specific to each page (i.e. pageLabel,
pageValue, isSelected). Oh, also the Scroller does not return the whole List
of objects to the page. It trims it down to the appropriate subList of the
cached results.

Scroller - populates ScrollerBean and ScrollerPageBean

ScrollerBean - contains shared values for paging and contains a collection
of ScrollerPageBeans
        properties:
        * int next - nextPage Number
        * boolean isNext - is there a next page
        * int previous - previous Page number
        * boolean isPrevious - is there a previous page
        * resultSize - this holds the total result size of the initial
result set
        * List objects - A list of beans usually generated from a recordset
to bean
list translation
        * List scrollerPageBeans - A list of page values for generation of
page
list (ex 1 2 3 4)

ScrollerPageBean - contains page specific paging values
        * int pageNum - array location of page Number to be passed back when
the
page is selected
        * int currPage - viewable page number (pageNum +1) so if pageNum is
0 (the
index in the List) then the currPage would be 1
        * boolean selected - a boolean indicating if this is the current
page being
viewed.

All of this is then passed to the page where you can easily use tag libs to
produce a page list.

Brandon Goodin
Phase Web and Multimedia
P(406)862-2245
F(406)862-0354
http://www.phase.ws

-----Original Message-----
From: Chen, Dean (Zhun) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 01, 2002 9:46 AM
To: 'Struts Users Mailing List'
Subject: pagination & session scope issue


Hi,
I'm currently using Pager from JSPTags.com to do pagination. However, I'm
running into problems because it requires the data  to be kept in session
scope. Basically the problem is that if 2 windows for a single application
are open, the pagination mechanism fails because it uses the latest data in
session scope.
Is there a way around this besides going back to the database for every
pagination?

How does big websites like amazon, google, yahoo solve this problem??

Thanks a lot.

Dean Chen

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to