aspose file tools*
The moose likes Struts and the fly likes Problem with getRowData() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with getRowData() method" Watch "Problem with getRowData() method" New topic
Author

Problem with getRowData() method

Craig Nicoll
Greenhorn

Joined: Nov 26, 2004
Posts: 3
Hello,

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:column>
<h utputText value="#{cd.title}" />
</h:column>
<h:column>
<h utputText value="#{cd.artist}" />
</h:column>
<h:column>
<h utputText value="�#{cd.price}" />
</h:column>
<h:column>
<h:commandButton id="addtocart" action="#{CDDetails.addToCart}" value="#{bundle.add_to_cart_label}" />
</h:column>
</h ataTable>
</h:form>


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);}
finally{
createItems();
}
}
} // 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with getRowData() method
 
Similar Threads
JSF java.util. Concurrent ModificationException
Please HELP me. How To Hard Code Values in Each Row of a dataTable?
JSF: Need advice on acheiving specific funcationality
Which Package to Import to Use FacesContext's getRequestMap()?
Input in a Nested table