Using Display Tag on a JSP page help

Hey Guys,

I am trying to create a jsp page I want to use DisplayTag Library to display results from my database table.
I might have 1,000,000 records and I want to display like 50 recordds first page then 50 on second so forth.

I am having a lot of trouble with DisplayTag Library.

I am new to java so can someone point me in a direction.

I can get the data from the table fine.

This is what I got on my page as far as DisplayTag is concerned.
What other referneces do I need? or beans?

RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
request.setAttribute("results", resultSet);

<display:table name="requestScope.results.rows" />

Thanks for all your response
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

No, you cannot instruct diaplay tag library to read data from ResultSet directly. It needs a List/array of beans , so that means you need to preprocess ResultSet (in your Struts action/Spring controller/other handling the request component) to create List/array of beans and then pass it to display tag library as you wrote.
/*Your java file*/
ResultSet rs;
//get ResultSet from database
List list = new ArrayList();
if (rs != null) {
        DataBean bean = new DataBean();//You need to create some data bean class and use it here
        d.setProperty1(rs.getString(1)); //set some String property you probably selected in SELECT sql clause
        d.setSygnKHidden(rs.getInt(2)); //the same for int
        //.. set all bean properties                
        //put bean into list
/* - just an example, rename class name and properties*/
public class DataBean{
   private String property1;
   private int property2;
   public String getProperty1(){
       return property1;
   public int getProperty2(){
       return property2;
   public void setProperty1(String p){
       property1 = p;
   public void setProperty2(int p){
       property2 = p;
<%-- Your JSP--%>   
<display:table id="row" name="dysp" pagesize="${__pagesize}">
    <!-- replace property1, property2 with actual properties-->
    <display:column property="property1" />
    <display:column property="property2" />

Open in new window

Sorry I did notice now that you use RowSetDynaClass. You can forget my previous post, but as long as display tag supports DynaBeans - don't know if it actually does... In that case use it like this:

<%-- Your JSP--%>   
<display:table name="requestScope.results.rows" pagesize="50">
    <display:column property="columnName1" />
    <display:column property="columnName2" />

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
In fact, display tag does not need to support DynaBeans - code below should work regardless (although is not pretty). As columnName1, columnName2 user column names from your SELECT clause.
<%-- Your JSP--%>   
<display:table name="requestScope.results.rows" pagesize="50" id="myDynaBean">

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.