关于这个异常(在线等!)谢谢! java.lang.ClassCastException: org.apache.struts.action.DynaActionForm没有碰见过。。不知道怎么处理1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 强制转换类型错误判断一下再转换,例如List userList = getUserList(param);if(null != userList){ for(Object obj:userList){ if(null != obj && obj instanceof UserDTO){ UserDTO user = (UserDTO)user; } }} System.out.println("----------------------->"); //接受产品类别名称 String categoryName =(String)ppForm.get("categoryName"); System.out.println(categoryName+"----------------------->"); //接受产品名称 String productName=(String)ppForm.get("productName");//产品名称 System.out.println(productName+"------------------------->"); Long companyId = (Long)ppForm.get("companyId"); Long categoryId = (Long)ppForm.get("categoryId"); CompanyProfile ins_company = null; if(null != companyId && companyId>0)ins_company = cpService.findById(companyId); ProductCategories ins_categories = null; if(null != categoryId && categoryId>0)ins_categories = pcService.getCategories(categoryId);其他的没有喔 !不知道问题在哪 cpService.findById(companyId)的返回值类型是CompanyProfile 吗?pcService.getCategories(categoryId); 的返回值类型是ProductCategories 吗?如果不是就可能出现异常 看看你取值的类型是否与你动态ActionForm中定义的类型匹配 看看你取值的类型是否与你动态ActionForm中定义的类型匹配 WEB工程的路径问题 javawebstart 下载错误是怎么回事?知道的告诉一哈! 格式化时间的问题 IE如何分辨页面 spring 如何统一处理异常 ie缓存问题,help! 在cmp中用locate查询时总报字符无效,是怎么回事 jsp的问题 在jsp中如何在进行ssl身份验证获得用户输入的用户名? fastjson string转jsonObject 浮点型转化完后默认都是bigdecimal JS弹出层(页面不刷新),如汽车之家网上的车型对比功能 小弟在学习的过程中遇到一个问题,望各位大哥多多指点!
判断一下再转换,例如
List userList = getUserList(param);
if(null != userList){
for(Object obj:userList){
if(null != obj && obj instanceof UserDTO){
UserDTO user = (UserDTO)user;
}
}
}
//接受产品类别名称
String categoryName =(String)ppForm.get("categoryName");
System.out.println(categoryName+"----------------------->");
//接受产品名称
String productName=(String)ppForm.get("productName");//产品名称
System.out.println(productName+"------------------------->");
Long companyId = (Long)ppForm.get("companyId");
Long categoryId = (Long)ppForm.get("categoryId");
CompanyProfile ins_company = null;
if(null != companyId && companyId>0)ins_company = cpService.findById(companyId);
ProductCategories ins_categories = null;
if(null != categoryId && categoryId>0)ins_categories = pcService.getCategories(categoryId);其他的没有喔 !不知道问题在哪
pcService.getCategories(categoryId); 的返回值类型是ProductCategories 吗?
如果不是就可能出现异常