You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Leahy, Kevin" <Ke...@drkw.com> on 2006/01/24 10:02:42 UTC

RE: [OT-ANN] Java Web Parts v1.0 beta3 and Tags For Pagination

Frank,

Having used your JWP to implement a text auto-complete gadget I though both
the implementation and the instructions were great. I had it working in a
few hours. Thanks!

Following the earlier thread entitled Tags For Pagination I wondered if JWP
might take this generic problem up. Paging through results seems to me an
ideal use of AJAX.

After following your example with JWP I turned to this exact situation a
month or two ago and couldn't see a quick solution, but then I'm a dummy
when it comes to AJAX.

Suppose you have a search facility that performs an initial search that
returns 5000 results and you wish to provide functionality to allow users to
page through the 5000 results 100 or 500 results at a time.

The initial search can easily store ids of objects in the users session and
additionally you can easily write a servlet ( as in your examples ) that
builds up the appropriate page of results into html. On the jsp I wrote a
paging section like this:

<Previous> 1 - 2 - 3 - 4 .... <Next>

Each a link to the servlet that built up the appropriate set of results
using the page number.

The problem was that the paging navigation needs to change each time. For
example if you are on page 1 there is no <previous>. If you are on the last
page there is no <Next> and also I wanted the current page not to be a link.
You already have that page and it helps the user to know where they are so I
coloured that page in red I think.

But I couldn't see a way of making the servlet redraw the links.

I hope this makes sense.. Is there a work around to this or am I just
talking nonsense?

I feel that this should be possible and perhaps could be turned into some
generic JWP tags. Certain from reading the other threads I can see other
developers looking at the same problem.

Rgds

Kevin


-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com] 
Sent: 24 January 2006 05:19
To: Struts User; Tomcat User
Subject: [OT-ANN] Java Web Parts v1.0 beta3

Hi all... I haven't been posting JWP release announcements here lately, and
generally I will refrain from doing so, but the team just put out a new
release last night and I think it has some features that might be of
interest to many of you...

* AjaxTags now has some new capabilities, including the ability to have
multiple config files, the ability to have static parameters on the target
URLs, a built-in debugging facility and an implicit passing in of the
ajaxRef with each request, so now you can always determine which element
fired the event.

* The Chain implementation now supports loading config files from JAR files,
and there is now a SimpleCommand that you can extend (instead of
implementing Command) that has default implementations of all three Command
methods (init(), execute() and destroy()), so you can only worry about the
ones that interest you.

* A new popup calendar widget has been added to the UIWidgets taglib.

* JSDigester was added to the JSTags taglib.  JSDigester, as you may be able
to guess, is a client-side implementation of our beloved Commons Digester.
It is not as full-featured as it's big brother, but it can come in *very*
handy, just like the full-fledged Digester.

Take care!

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
 ------


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender. 3166
--------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [OT-ANN] Java Web Parts v1.0 beta3 and Tags For Pagination

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
On Tue, January 24, 2006 4:02 am, Leahy, Kevin said:
> Frank,
>
> Having used your JWP to implement a text auto-complete gadget I though
> both
> the implementation and the instructions were great. I had it working in a
> few hours. Thanks!

Glad to hear it, thanks for the feedback!  I know the whole team
appreciates hearing success stories :)

> Following the earlier thread entitled Tags For Pagination I wondered if
> JWP
> might take this generic problem up. Paging through results seems to me an
> ideal use of AJAX.

I've thought about it... we are now starting to discuss the idea of
creating an entire AJAX-based widget library, and this is the type of
thing I could see being part of it.  There is some debate though because I
have started working on a whole new application framework specifically
geared to creating next-generation webapps (RIAs, Web 2.0, whatever the
hype term du jour is).  The debate is whether the widget library should be
specific to that framework or more generic.  Since the framework would
provide a real event model, not just on the component level but on the
"screen" level, the widgets probably could not be generic and still be
hooked in to the event model and lifecycle model properly.

I guess I'm getting a little off-track though :)

In answer to your question, yes, we've talked about it as part of a larger
discussion, and something could indeed be forthcoming :)

> After following your example with JWP I turned to this exact situation a
> month or two ago and couldn't see a quick solution, but then I'm a dummy
> when it comes to AJAX.
>
> Suppose you have a search facility that performs an initial search that
> returns 5000 results and you wish to provide functionality to allow users
> to
> page through the 5000 results 100 or 500 results at a time.
>
> The initial search can easily store ids of objects in the users session
> and
> additionally you can easily write a servlet ( as in your examples ) that
> builds up the appropriate page of results into html. On the jsp I wrote a
> paging section like this:
>
> <Previous> 1 - 2 - 3 - 4 .... <Next>
>
> Each a link to the servlet that built up the appropriate set of results
> using the page number.
>
> The problem was that the paging navigation needs to change each time. For
> example if you are on page 1 there is no <previous>. If you are on the
> last
> page there is no <Next> and also I wanted the current page not to be a
> link.
> You already have that page and it helps the user to know where they are so
> I
> coloured that page in red I think.
>
> But I couldn't see a way of making the servlet redraw the links.
>
> I hope this makes sense.. Is there a work around to this or am I just
> talking nonsense?

No, not nonsense at all :)  What you are describing is typically referred
to as "VCR controls", and how you describe them working is pretty normal. 
I have at least some experience in this area because on my personal web
site I have such a system for flipping through pictures.  It was done 6
years ago in ASP, but it works pretty much as you describe... the only
difference is that the links are buttons, and the current page isn't
disabled, it is just marked differently so you can tell where you are, and
it isn't AJAX-based.

My concern in doing it as a tag, and in Java in general, is in determing
what part of the result set to get (and I suppose at this point this makes
more sense in the pagination thread)... in my ASP version, the ODBC driver
has the capability of returning part of a result set based on a starting
point.  For instance, if I have 100 pictures, and I want 10 on a page, I
know that the pictures on page 2 should begin with the 11th picture.  What
you can do is basically say to the drive "ok, perform this query: select *
from pictures order by date, and then only return to me the results
starting from the 11th".

So, there is no need to store keys in session, which I would suggest is a
bad idea if there is any chance the result set could be larg-ish. 
Unfortunately, AFAIK, this method of specifying a starting result is
driver-specific, and maybe even database-specific.  Something like that
though is really the ideal solution... the databse would simply not return
results that you are not interested in... in fact, you specify not only
the starting index, but also the maximum number of results, so in my
example above, I can specify to always get 10 results, or less if the last
page didn't have a full 10 pictures, but never more.  In that scenario,
you don't bother caching anything, you just do a new query each time
(which arguably isn't the most efficient way, but it's a toss-up between
efficiency and potentially having a massive session that begins to effect
replication in a distributed environment or persistence on a single box,
in which case it's hardly efficient anyway!)

That's really the problem I see with this whole pagination discussion...
whether it's AJAX-based or not isn't really a big thing, and certainly the
actual controls and such are not a big deal to implement.  It's dealing
with a potentially large result set that's the issue, and I don't know how
generically to deal with that efficiently.

> I feel that this should be possible and perhaps could be turned into some
> generic JWP tags. Certain from reading the other threads I can see other
> developers looking at the same problem.

Absolutely!  And, if anyone would like to contribute such a tag to JWP, it
would be more than welcome (hint-hint!) ;)

> Rgds
>
> Kevin

Frank

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org