• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with getRowData() method  RSS feed

Craig Nicoll
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am having a problem when using the getRowData() method on an instance of UIData. I get the following error message:

javax.faces.el.EvaluationException: java.lang.ClassCastException: java.util.TreeMap

I don't know why TreeMap is mentioned as I don't use it at all. Here is my code:

<h:form id="shoppingForm">
<h ataTable value="#{CDDetails.all}" var="cd" binding="#{CDDetails.table}">
<h utputText value="#{cd.title}" />
<h utputText value="#{cd.artist}" />
<h utputText value="�#{cd.price}" />
<h:commandButton id="addtocart" action="#{CDDetails.addToCart}" value="#{bundle.add_to_cart_label}" />
</h ataTable>

public class CDDetails {

private UIData table;

public void setTable(UIData table) {this.table = table;}
public UIData getTable() {return this.table;}

public void addToCart() {
CD cd = (CD) table.getRowData(); // THE PROBLEM IS HERE

public Result getAll() throws SQLException, NamingException {
try{resultSet = DatabaseBean.performQuery
("SELECT * FROM cd WHERE release_date > '2004-01-01' ORDER BY release_date DESC");
return ResultSupport.toResult(resultSet);}
} // end class CDDetails

public class CD {

public CD(String catalogueNo, String artist, String title, Date releaseDate, String label, String genre, double price){
this.catalogueNo = catalogueNo;
this.artist = artist;
this.title = title;
this.releaseDate = releaseDate;
this.label = label;
this.genre = genre;
this.price = price;
}// end class CD

I would be massively grateful if anyone could point out where I'm going wrong
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!