I'd like to display the data from a bean using the displaytag, but i wouldn't want to put it inside am collection in order to allow displaytag to render it, is it possible?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just curious - why do you want to use the displaytag at all if you're not rendering a list of data? If you have a collection as a property on your bean, you could use that...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The easiest way is to probably reproduce HTML that is similar to the HTML that the displaytag renders (do a view source on your existing one). JSTL's <c:forEach> is probably a good way to do this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If we can give beans to the table, why can't we get beans from the table ? None of the tags are named or id'd. We cannot iterate thru javascript.
How do we take out from the table on a slective basis ? What if we sort the contents ?
There is no way to use the data after ?
Can anyone provide a solution to operate on selected data within the table ? Ideally one would like to cache it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-01-15
Matt,
When you say "If you have a collection as a property on your bean" do you mean a bean (MotherBean) having a property that is a collection of childBeans ?
I guess what I'm getting at is, does displayTag expect every row to be a bean instance?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the displaytag expects every row to be a JavaBean.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-01-15
Matt,
Thank you for the answer. I have another question;
I have a design as follows;
1) Have a rowBean.java.vm (Velocity template)
2) User creates a SQL request and submits
3) From resultSetMetaData the column Types and names are extracted, and used in generation of rowBean.java from template
4) rowBean.java is compiled, instantiated with the data in the resultSet. Then these instances are filled into a resultContainer.java (like examples) instance.
5) resultContainer is passed to displayTag and displayTag is used to display the results.
What do you (or anyone else) think about this design?
Is it unnecessarily complex?
Is there better a one (that is documented)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It definitely *sounds* too complex. I like using iBatis and Hibernate because both of them allow you to get a List of populated beans from only a couple lines of code.
I think you could use a RowSet and to a "toCollection()" on it, that might be easier if you want to stick with JDBC.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd like to display the data from a bean using the displaytag, but i wouldn't want to put it inside am collection in order to allow displaytag to render it, is it possible?
Just curious - why do you want to use the displaytag at all if you're not rendering a list of data? If you have a collection as a property on your bean, you could use that...
To get the same looking of the tables that goes under this :)
I will show the properties of a company and it's contacts. So I'd like to have both with the same looking without having to format the first one.
The easiest way is to probably reproduce HTML that is similar to the HTML that the displaytag renders (do a view source on your existing one). JSTL's <c:forEach> is probably a good way to do this.
I did a workaround : Sent a arraylist with just one bean inside it :)
If we can give beans to the table, why can't we get beans from the table ? None of the tags are named or id'd. We cannot iterate thru javascript.
How do we take out from the table on a slective basis ? What if we sort the contents ?
There is no way to use the data after ?
Can anyone provide a solution to operate on selected data within the table ? Ideally one would like to cache it.
Matt,
When you say "If you have a collection as a property on your bean" do you mean a bean (MotherBean) having a property that is a collection of childBeans ?
I guess what I'm getting at is, does displayTag expect every row to be a bean instance?
Yes, the displaytag expects every row to be a JavaBean.
Matt,
Thank you for the answer. I have another question;
I have a design as follows;
1) Have a rowBean.java.vm (Velocity template)
2) User creates a SQL request and submits
3) From resultSetMetaData the column Types and names are extracted, and used in generation of rowBean.java from template
4) rowBean.java is compiled, instantiated with the data in the resultSet. Then these instances are filled into a resultContainer.java (like examples) instance.
5) resultContainer is passed to displayTag and displayTag is used to display the results.
What do you (or anyone else) think about this design?
Is it unnecessarily complex?
Is there better a one (that is documented)?
It definitely *sounds* too complex. I like using iBatis and Hibernate because both of them allow you to get a List of populated beans from only a couple lines of code.
I think you could use a RowSet and to a "toCollection()" on it, that might be easier if you want to stick with JDBC.
If you are using RowSet then you can use RowSetDynaclass.
Something like this: RowSetDynaClass resultSet = new RowSetDynaClass(crs);
see the following link for more details:
http://displaytag.sourceforge.net/11/tut_sources.html