wood burning stoves
The moose likes JSP and the fly likes problem while using display taglib Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem while using display taglib" Watch "problem while using display taglib" New topic

problem while using display taglib

kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
i faced while using display taglib;please help me;

i have created one bean class;

package example;
import java.util.*;
public class player
private String name;

ArrayList player = new ArrayList();

String arr[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o"};

public player()

for(int i=0;i<arr.length;i++)
this.name = arr[i];
System.out.println(".......in model="+this.name);
this is my TAG.jsp file

<%@ include file="init.jsp" %>

<%@ page import="java.util.*"%>

session.setAttribute( "test", new player() );


<display:table name="test" scope="session" sort="list" pagesize="5" id="table1">
<display:column property="name" title="name" group="1" sortable="true" headerClass="sortable"/>


<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display" %>
<%@ page import="example.player%>

when i run TAG.jsp i got this error

Exception: [.LookupUtil] Error looking up property "name" in object type "example.player"Cause: Unknown property 'name'
java.lang.Object org.displaytag.util.LookupUtil.getBeanProperty(java.lang.Object, java.lang.String)
java.lang.Object org.displaytag.model.Column.getValue(boolean)
java.lang.String org.displaytag.model.Column.createChoppedAndLinkedValue()
java.lang.String org.displaytag.model.Column.getOpenTag()
java.lang.String org.displaytag.tags.TableTag.getTableBody()
java.lang.String org.displaytag.tags.TableTag.getHTMLData()
int org.displaytag.tags.TableTag.doEndTag()
void _TAG._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void com.evermind[Oracle9iAS ( Containers for J2EE].server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void com.evermind[Oracle9iAS ( Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
boolean com.evermind[Oracle9iAS ( Containers for J2EE].server.http.HttpRequestHandler.processRequest(com.evermind[Oracle9iAS ( Containers for J2EE].server.ApplicationServerThread, com.evermind[Oracle9iAS ( Containers for J2EE].server.http.EvermindHttpServletRequest, com.evermind[Oracle9iAS ( Containers for J2EE].server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
void com.evermind[Oracle9iAS ( Containers for J2EE].server.http.HttpRequestHandler.run(java.lang.Thread)
void com.evermind[Oracle9iAS ( Containers for J2EE].server.http.HttpRequestHandler.run()
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
void java.lang.Thread.run()

i have doubt that what i am doing is correct or not;please guide me;is is necassary to create player class;

Pankaj Narang
Ranch Hand

Joined: Jun 07, 2004
Posts: 81
Hi kesav

U have used the dispaly yaglib correctly but the name= test is not a collection and in ur palyer bean add the values or arr in arraylist u r not doing any thing and also don;t use display:column as ur collection wont contain objects which has properties the display:column will display only the properties of the objects which r stored in the collection if u have simple strings or char they wont have any property so u cant use display:column just write the display:table tag for the arraylist in which only strings or chars are stored.

See the main error is that ur collection doesnt contain any thing u have to add the chars in the arraylist then put it in session and use it in the jsp

That will work

Any further problem post it

Best Regards
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63060


JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

JSP Forum Bartender

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
hi pankaj,

i have written this example;please correct me in this example;


<%@ include file="init.jsp" %>

<%@ page import="java.util.*"%>

request.setAttribute( "test", new Player(16) );


<display:table name="test" export="true" sort="list" pagesize="5" id="table1">
<display:column property="name" title="NAME" group="1"/>


package example;
import java.util.*;

public class Player extends ArrayList

public Player(int size)
for (int j = 0; j < size; j++)
add(new ReportableListObject(size));




package example;

import java.util.Random;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.commons.lang.builder.CompareToBuilder;

* A test class that has data that looks more like information that comes back in a report.
* @author epesh
* @version $Revision$ ($Author$)
public class ReportableListObject extends Object implements Comparable

private static String[] players = {"Sachin1", "Sachin1", "Sachin1", "Sachin1","Sachin1", "Sachin1", "Sachin1", "Sachin1","Sachin1", "Sachin1", "Sachin1", "Sachin1","Sachin1", "Sachin1", "Sachin1", "Sachin1"};

private String name;

* Constructor for ReportableListObject.
public ReportableListObject(int size)
for(int i=0;i<size;i++)
this.name = players[i];

public String getName()

return this.name;


i have modified the example of displaytaglib.war
is it neccassary to write ReportableListObject;what it will do?

i want to print out the names with paging(16 records) and sorting;
cant we do it with one bean file?

[ June 23, 2004: Message edited by: kesava chaitanya ]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: problem while using display taglib
It's not a secret anymore!