Matt Raible wrote:
On Apr 27, 2005, at 12:21 AM, Pavankumar wrote:
I have problem in displaying data in displaytag table. I am fetching data
from database into an arraylist/list object.
al = getData() // fetches data from database and arraylist object al holds the
data. al can be arraylist object or list object
request.setAttribute("results",al);
<display:table name="$(results) pagesize="10">
<display:column property:"F1" value=" "> // F1 is table column name in database
Your syntax looks funny - shouldn't it be property="F1"? There needs to be a getF1() methods on the objects that are loaded into the "al" list.
He did send a corrected version just a bit ago...
I'm not sure how displaytag will treat that F1 thing. Normally displaytag converts your property from "property" to "getProperty()", i.e. it capitalizes the first letter of the property name. Will starting the property name with a capital cause an issue? It might.
So first suggestion is to try property="f1".
Second, what kinds of objects are going into your list object? Without knowing what objects are in the list returned by your getData() method and without knowing what kind of undesired result you get (you still haven't said precisely what's going wrong, just that you're having a problem), it's very difficult to tell what's going on in that part. The first thing I'd guess is that you're returning a list of lists or hashtables, which require special treatment. Really, displaytag is most comfortable (in my experience) handling bean objects, i.e. instead of needing to do get("key"), you've got property getters and setters.
Finally, one thing that's DEFINITELY wrong is this:
<display:table name="$(results) pagesize="10">
The double quotes around the name aren't closed, so that would cause an error. Fix that, but there's another, even bigger problem here. You don't need an EL expression for the name attribute and you're not specifying a valid EL expression for the name attribute anyways.
First, for valid EL expressions, you have to use '{' and '}' braces. So that would be ${results} instead of $(results). Second, an EL expression *evaluates* out to its String value, which is not what you want in that case. Since you're never setting a value for "results", that would definitely give you unexpected results; setting an object as a request attribute with a particular key does not create an object of that name with a particular value. Instead, you want to pass the name used to store the object in the request attribute store. In this case, that is literally "results":
<display:table name="results" pagesize="10">
You've got a lot of problems going on with this in terms of valid syntax, using expressions in the proper place, and so on. I'd really suggest using NetBeans or Eclipse or (optimally, but it costs money) IntelliJ IDEA to help you more easily spot problems in your syntax. Any one of those environments would have alerted you to the problem with not closing the quotes (at least, with the appropriate add-ons; I think you need a plug-in in Eclipse to properly parse JSP files).
-- Rick Herrick [EMAIL PROTECTED]
I haven't got time for inner peace.
Get out of control, but appear under control. It's not bad to alarm other people, though--it's good for them.--Hunter S. Thompson
------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ displaytag-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/displaytag-user

