Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.ClassCastException  RSS feed

 
Naveen R R
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could someone help me with this?
Here is my code:
public class CompanyCodeBean {
private java.lang.String coCode;
private java.lang.String coDescr;
}
public class CostCenterBean {
private CompanyCodeBean company;
------
}
public class TeamBean {
private CostCenterBean costCenter;
----
}
public class DataTable {
private java.util.Vector table;
public Object getRow(int index) {
if (index < 0 | | index > getRowCount()) {
return null;
}
return table.elementAt(index);
}
------
------
}
public class ProjectSaveForm {
public boolean processIncomingRequest
(javax.servlet.http.HttpServletRequest request) {
-----
DataTable teams = ----
------
------
CompanyCodeBean company = new CompanyCodeBean();
CostCenterBean costCenter = new CostCenterBean();
company.setCoCode(((CostCenterBean)teams.getRow
(row)).getCompany().getCoCode());
------
------
I am trying to cast Datatable teams into CostCenterBean. But, it gives java.lang.ClassCastException.
Any ideas?
Thanks,
Naveen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!