java.lang.ClassCastException: org.apache.struts.action.DynaActionForm没有碰见过。。不知道怎么处理1

解决方案 »

  1.   

    强制转换类型错误
    判断一下再转换,例如
    List userList = getUserList(param);
    if(null != userList){
        for(Object obj:userList){
           if(null != obj && obj instanceof UserDTO){
              UserDTO user = (UserDTO)user;
           }
        }
    }
      

  2.   

    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);
    其他的没有喔 !不知道问题在哪
      

  3.   

    cpService.findById(companyId)的返回值类型是CompanyProfile 吗?
    pcService.getCategories(categoryId); 的返回值类型是ProductCategories 吗?
    如果不是就可能出现异常
      

  4.   

    看看你取值的类型是否与你动态ActionForm中定义的类型匹配
      

  5.   

    看看你取值的类型是否与你动态ActionForm中定义的类型匹配