|
A robust starter web application to ease Java webapp development. Home | Tutorials | Demos | Issues |
|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
DisplayTag external paging and sorting exampleHi,
I've put together a new Appfuse project which demonstrates how to enhance the List screens. DisplayTag as provided has issues with large datasets, (it retrieves all the records every time), and sorting via column headings does not work for the entire dataset, only those on screen at the time. I've built a project which addresses these issues, using Hibernate Criteria and extensions to DisplayTags PaginatedList interface which gets DisplayTag to hand off all requests for sorting and paging to the new implementation of PaginatedList. The Google Code project is checked in to: http://code.google.com/p/pagingappfuse/ feel free to check out the code and comment. (instructions here: http://code.google.com/p/pagingappfuse/source/checkout ) There are instructions regarding the steps taken on the project wiki page here: http://code.google.com/p/pagingappfuse/wiki/PagingSorting Cheers, Chris |
|
|
Re: DisplayTag external paging and sorting exampleHi, is this strictly for projects that use the displayTag or can it be implemented for appfuse-jsf projects also?
..kace |
|
|
Re: DisplayTag external paging and sorting exampleThis is great stuff Chris - thanks for putting it together! We hope to
add external pagination support by default to 2.1. Your code and tutorial should make this much easier. Highly appreciated. Matt On Sat, May 17, 2008 at 12:37 AM, Chris Barham <cbarham@...> wrote: > Hi, > > I've put together a new Appfuse project which demonstrates how to enhance > the List screens. DisplayTag as provided has issues with large datasets, > (it retrieves all the records every time), and sorting via column headings > does not work for the entire dataset, only those on screen at the time. > > I've built a project which addresses these issues, using Hibernate Criteria > and extensions to DisplayTags PaginatedList interface which gets DisplayTag > to hand off all requests for sorting and paging to the new implementation of > PaginatedList. > > The Google Code project is checked in to: > http://code.google.com/p/pagingappfuse/ feel free to check out the code and > comment. (instructions here: > http://code.google.com/p/pagingappfuse/source/checkout ) > > There are instructions regarding the steps taken on the project wiki page > here: http://code.google.com/p/pagingappfuse/wiki/PagingSorting > > Cheers, > Chris --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: DisplayTag external paging and sorting exampleHi Kace,
On Sat, May 17, 2008 at 9:31 PM, kace <me_myself_and_aye@...> wrote:
I've not used JSF before, but presumably it uses a Table or List for the Master screens. The example I gave uses an implementation of DisplayTags PaginatedList interface to get the desired functionality - perhaps if you swapped this out for something more generic, you could still use the Hibernate paging lookup DAO and Manager.
I would suggest looking at using re-using Springs PagedListHolder object:
along with it's SortDefinition: Using these would achieve the same thing as extending DisplayTags PaginatedList. The only implementation detail that you'd then need to look at would be the helper object that decodes the request parameters, (what page, what sort direction and what sort property is requested). Hook that up to however JSF is displaying the List, and the UI is doing paging, and you should be on the right track.
Cheers,
Chris |
|
|
Re: DisplayTag external paging and sorting exampleMaybe the solution for 2.1 is to move from displayTag to eXtremecomponents and jMesa. jMesa doesn't have the problem described by Chris, it has column filtering out-of-the box and it support ajax requests nicely (without external libraries such as ajaxtags for displaytag)
I am currently in the middle of migrating an appfuse project from displaytag to jMesa. I still have some issues, mostly related to ajax tags and inline scripts but if I succeed in my quest I will let you know :) Br, Oscar On Sat, May 17, 2008 at 5:14 PM, Matt Raible <matt@...> wrote: This is great stuff Chris - thanks for putting it together! We hope to |
|
|
Re: DisplayTag external paging and sorting exampleThat'd be great Oscar. I don't mind switching to a different library if it has all the same features as the Display Tag. If you write a tutorial on how to integrate JMesa (or even better, create a JIRA and attach a patch), it's much more likely we'll switch. Thanks, Matt
|
|
|
Re: DisplayTag external paging and sorting exampleOn May 17, 2008, at 8:37 AM, Chris Barham wrote:
> Hi, > > I've put together a new Appfuse project which demonstrates how to > enhance the List screens. DisplayTag as provided has issues with > large datasets, (it retrieves all the records every time), and > sorting via column headings does not work for the entire dataset, > only those on screen at the time. > > I've built a project which addresses these issues, using Hibernate > Criteria and extensions to DisplayTags PaginatedList interface which > gets DisplayTag to hand off all requests for sorting and paging to > the new implementation of PaginatedList. > > The Google Code project is checked in to: http://code.google.com/p/pagingappfuse/ > feel free to check out the code and comment. (instructions here: http://code.google.com/p/pagingappfuse/source/checkout > ) > > There are instructions regarding the steps taken on the project wiki > page here: http://code.google.com/p/pagingappfuse/wiki/PagingSorting > > Cheers, > Chris Chris, Your tutorial was really excellent. I have two issues, that I was wondering if someone on the list would be able to help with: 1. I notice you're using DetachedCriteria in your Hibernate implementation. Does anyone know what the best method to would approach this would be with JPA? Is there any equivalent using the JPA API? 2. One other issue (that I'd be happy to help work on, since it benefits me), is with modular Appfuse-based applications - which I tend to use pretty much exclusively. I'm not too strict of a purist when it comes to keeping the DAO/ Service/Web layers decoupled from each other (or at least as long as the layers only know about each other in one direction), but this solution does start to couple things together. This is particularly noticeable if you use the modular archetype. as you would end up having to have the DisplayTag as a dependency in your *-core module. Parts of this problem would have a simple resolution, such as recreating a SortOrderEnum or passing a string for sort order to your DAO. However, pushing the classes in the helper package you created class down to the *-core module certainly would make DisplayTag a dependency. Thanks, Alex --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: DisplayTag external paging and sorting exampleOn Fri, May 23, 2008 at 8:27 PM, Alexander Coles <alex.coles@...> wrote:
> Chris, > > Your tutorial was really excellent. I have two issues, that I was wondering > if someone on the list would be able to help with: > > 1. I notice you're using DetachedCriteria in your Hibernate implementation. > Does anyone know what the best method to would approach this would be with > JPA? Is there any equivalent using the JPA API? > > 2. One other issue (that I'd be happy to help work on, since it benefits > me), is with modular Appfuse-based applications - which I tend to use pretty > much exclusively. > > I'm not too strict of a purist when it comes to keeping the DAO/Service/Web > layers decoupled from each other (or at least as long as the layers only > know about each other in one direction), but this solution does start to > couple things together. This is particularly noticeable if you use the > modular archetype. as you would end up having to have the DisplayTag as a > dependency in your *-core module. > > Parts of this problem would have a simple resolution, such as recreating a > SortOrderEnum or passing a string for sort order to your DAO. However, > pushing the classes in the helper package you created class down to the > *-core module certainly would make DisplayTag a dependency. > > Thanks, > > Alex > I think I hit send a little too fast on the previous email... To partially answer my own question, or at least part 1 -- having recently switched over to JPA from Hibernate, I should have realized there is no Criteria API in JPA. So the solutions is one of the following: a) handle criteria myself, or b) since I am still using Hibernate as the implementation (even if I am using the JPA API), to use Hibernate's native API where I need to handle criteria. So a PagingLookupDaoJpa.java implementation might look something like this: public List<NewsItem> getAllRecordsPage(int first, int max, SortOrder direction, String criterion) { Query q = entityManager.createQuery("select n from NewsItem n"); // handle the criteria q.setFirstResult(first); q.setMaxResults(max); List<NewsItem> items = q.getResultList(); return items; } //NOTE THE JPA SPEC RETURNS LONGs for COUNT aggregate queries public Long getAllRecordsCount() { Query q = entityManager.createQuery("select count(n) from NewsItem n"); return (Long) q.getSingleResult(); } --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: DisplayTag external paging and sorting exampleMy experience with jMesa is not so good. Compared to displaytag, it is not better imho. It claims to be very java5 friendly, however the javadoc tells another story: * a lot of java.lang.Object in return types (see http://docs.jmesa.org/org/jmesa/web/HttpServletRequestWebContext.html for a good example) * many things not easily pluggable or IoC-able (see http://docs.jmesa.org/org/jmesa/facade/tag/TableFacadeTag.html - you set the Messages impl you want to use through an attribute that takes a class name (a String), instead of a Messages instance or a factory...!! Now how do I integrate this with JSTL or Spring's MessageSource?) I agree it looks promising from the home page, however it is a bit misleading in places ;-) The ajax stuff may be nice, but I'd rather take displaytag + ajaxtags than jMesa at the moment. I am looking for a displaytag-nextgen replacement - something fully generified, JSP 2.x friendly with ajax capabilities. I don't think jMesa is it, though. - Renaud
|
|
|
Re: DisplayTag external paging and sorting example
|
|
|
Re: DisplayTag external paging and sorting exampleHi chris,
i cannot able to chekout the pagingappfuse prject from the mentioned repository, guide me, how to chekout the same. Or is there is any other source from where i can download it. Regards, hari
|
| Free Forum Powered by Nabble | Forum Help |
