Advertisement

06.22.2007 at 06:12PM PDT, ID: 22652638
[x]
Attachment Details

Working with JSF Tables (com.webui.jsf.component.Table) and Lists using ObjectListDataProvider for Sorting, Paging, and Memorizing Position

Asked by jboss79 in Java Server Faces (JSF), Java Server Pages (JSP), Java Servlets

Tags: jsf, table

Netbeans/Creator
OS Independant - Java Framework - JSF/JSP

My problem is that I am trying to handle JSF tables with the following functionality:
1. Sortable Column Headers
2. Paging
3. Clicking on a record to navigate to another page (detail page) and then return to the same position in the table when saving or cancelling out of that page.

I've tried using standard JSF components and found no paging support. I then switched to MyFaces and found it clumsy and poorly documented. I finally switched to the Sun JSF components available in NetBeans Visual WebPack. It handles paging very nicely, but doesn't work for sorting. I also haven't figured out how to leave my list to go to a detail and get back to the same place.

The code below accomplishes paging, but I have not figured out sorting or leaving and returning to the same place.  I don't want to tie the table directly to a DB table, but rather to a list of objects. I've included relevant code:

//init() method of the JSF Page
List<User> list = getOYSessionBean().getUserList();
        if(list == null || list.size()<=0){
            FacesContext context = FacesContext.getCurrentInstance();
            HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
            UserBean loginuser = (UserBean)session.getAttribute("LoginUserBean");
            if(loginuser!=null){
                User_Manager um = new User_Manager();
                um.setPubServerConnection(loginuser.getPubServerConnection());
                um.setServerConfig(loginuser.getServerUtility());
               
                if(um.readDBUsers(loginuser)==0) list = um.getUserList();
                getOYSessionBean().setUserList(list);
            }
        }
        getDpUserList().setList(list);

JSF Components used:
import com.sun.webui.jsf.component.Table;
import com.sun.webui.jsf.component.TableColumn;
import com.sun.webui.jsf.component.TableRowGroup;
import com.sun.data.provider.impl.ObjectListDataProvider;

Any support would be greatly appreciated. I've been reading tutorial after tutorial on the net, but have found minimal support for interacting with these components using Lists.

ThanksStart Free Trial
[+][-]06.23.2007 at 12:10AM PDT, ID: 19346789

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.18.2007 at 08:47PM PDT, ID: 19519241

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Server Faces (JSF), Java Server Pages (JSP), Java Servlets
Tags: jsf, table
Sign Up Now!
Solution Provided By: EE_AutoDeleter
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32