jboss79,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.
EE_AutoDeleter
Main Topics
Browse All TopicsNetbeans/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().getUser
if(list == null || list.size()<=0){
FacesContext context = FacesContext.getCurrentIns
HttpSession session = (HttpSession) context.getExternalContext
UserBean loginuser = (UserBean)session.getAttri
if(loginuser!=null){
User_Manager um = new User_Manager();
um.setPubServerConnection(
um.setServerConfig(loginus
if(um.readDBUsers(loginuse
getOYSessionBean().setUser
}
}
getDpUserList().setList(li
JSF Components used:
import com.sun.webui.jsf.componen
import com.sun.webui.jsf.componen
import com.sun.webui.jsf.componen
import com.sun.data.provider.impl
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.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: jboss79Posted on 2007-06-23 at 00:10:40ID: 19346789
Solved part of this one on my own and thought there must be others facing the same issues so I thought I would show my solutions. The only thing I have not solved is navigating away from the list and returning to the same page with the same sort order. Hopefully I can solve this and post it. If anyone can help me out on that, that would be great.
rList2 = new ObjectListDataProvider();
ataProvide r dpUserList2) {
n.dpUserLi st2}') and a reference to each data bean field in the column object (e.g. text="#{currentRow.value[' firstName' ]}"), where this refers to the bean property reference. RowGroup1} " id="tableRowGroup1" rows="10" n.dpUserLi st2}" sourceVar="currentRow"> Column1}" headerText="column1" id="tableColumn1" cText1}" id="staticText1" firstName' ]}"/>
erList2(). getList(); erList2(). setList(li st);
I am using Visual Web Pack in NetBeans so this may be a little different if you are using Creator.
1. First add an ObjectListDataProvider to your SessionBean as a property.
CODE:
/**
* Holds value of property dpUserList2.
*/
private ObjectListDataProvider dpUserList2;
/**
* Getter for property dpUserList2.
* @return Value of property dpUserList2.
*/
public ObjectListDataProvider getDpUserList2() {
if(dpUserList2==null)dpUse
return this.dpUserList2;
}
/**
* Setter for property dpUserList2.
* @param dpUserList2 New value of property dpUserList2.
*/
public void setDpUserList2(ObjectListD
this.dpUserList2 = dpUserList2;
}
2. Add a table object to a page
Add a reference to the ObjectListDataProvider in the JSP portion of the page. You'll need to reference the sourceData in the tableRowGroup (e.g. sourceData='#{OYSessionBea
CODE:
<webuijsf:table .....>
<webuijsf:tableRowGroup binding="#{testlist3.table
------>>>>> see source Data HERE: sourceData="#{OYSessionBea
<webuijsf:tableColumn binding="#{testlist3.table
sort="firstName">
<webuijsf:staticText binding="#{testlist3.stati
-------->>>>>> see column ref Here: text="#{currentRow.value['
</webuijsf:tableColumn>
</webuijsf:tableRowGroup>
</webuijsf:table>
3. Initialize the List property of the ObjectListDataProvider
I'm testing the value of the list to avoid calling this every time I sort or page.
List<User> list = getOYSessionBean().getDpUs
if(list == null || list.size()<=0){
..... POPULATE YOUR LIST HERE
getOYSessionBean().getDpUs
}
Hope this helps someone out there. I have not really figured out navigating away from the grid and then returning to the same page with the same sort order, but I'll post that if I figure it out. At this point I have solved sorting and paging using the Sun webui component.