Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8235981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:59:57+00:00 2026-06-07T18:59:57+00:00

I am using Seam and Java to make an h:dataTable that contains information from

  • 0

I am using Seam and Java to make an h:dataTable that contains information from a ArrayList filled with objects. My question is, is there any way to sort the table by clicking on one of the headers. I have some code right now and all it does is reload the table the same way that it was.

Here’s some of my code. Let me know if you need more:
Table:

<h:dataTable value="#{deliveryPort.getWholeDeliveryList()}" var="delivery" rules="rows">
                    <h:column>
                        <div class="setWidth">
                            <div class="white">
                            <f:facet name="header">
                                <h:outputLink style="color:#FFFFFF" action="#{deliveryPort.sortByAddress()}">
                                    Address
                                </h:outputLink>
                            </f:facet>
                            </div>
                            <h:outputText value="#{delivery.address}" />
                        </div>
                    </h:column>

Sort:

    public String sortByAddress(){
    for(int i = 0; i < wholeDeliveryList.size(); i++){
        for(int j= i+1; j<wholeDeliveryList.size(); j++){
            if(wholeDeliveryList.get(i).getAddress().compareTo(wholeDeliveryList.get(j).getAddress())<1){
                FlowerStoreDelivery temp = wholeDeliveryList.get(i);
                wholeDeliveryList.set(i, wholeDeliveryList.get(j));
                wholeDeliveryList.set(j, temp);
            }
        }
    }
    return "deliveryList.seam";
}

getWholeDeliveryList():

    public List<FlowerStoreDelivery> getWholeDeliveryList(){
wholeDeliveryList = new ArrayList<FlowerStoreDelivery>();
wholeDeliveryList.addAll(entityManager.createQuery("SELECT e FROM FlowerStoreDelivery e").getResultList());
    return wholeDeliveryList;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:59:59+00:00Added an answer on June 7, 2026 at 6:59 pm

    You can obtain a lot more info about DataTable including sorting and much more on this blog by BalusC, a JSF expert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java web app that I'm developing, using JBoss Seam as the
I have a question for any JBoss Seam developers out there: I am creating
We are using Seam 2.2.0 Java 1.6.14 Weblogic 10.3.1.0 (named 11g Doh!) I have
I haved generated simple CRUD application from seam-gen using seam generate-ui command, but the
I've been using Seam 2 (also started looking into Java EE 6) in my
We're developing a Java web app that utilizes JSF (Richfaces through Seam) for its
I am using Jetty 7 with JBoss Seam and have 2 Java Mail Sessions
I am developing a web application on JAVA EE 6 with SEAM 3, using
Using seam-gen based code. I have an object Classroom, which contains an instance of
Is there a way to use a Seam Logger inside of a standard Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.