问题描述
- 链表的add不执行也不报错
- 求大神解答,products是范型为Product的List,执行到products.add(product)的时候总是停下,也不报错,这是什么原因啊?
解决方案
Product product = new Product(); product = gDao.get(Product.class sql id); String attrnameids = product.getAttrname(); String []attrnameids2 = attrnameids.split(""#""); for(int i=0;i<attrnameids2.length;i++) { description += gDao.qureystr(sql3 attrnameids2[i])+"",""; } description = description.substring(4 description.length()-1); product.setDescription(description); int fid = product.getFid(); String fname = gDao.qureystr(sql2 fid); product.setFactory(fname); String pic = path+product.getPic(); product.setPic(pic); product.setCount(""1""); System.out.println(""4""); products.add(product); System.out.println(""6""); session.setAttribute(""products"" products);
解决方案二:
可能并不是你这段代码的问题,我记得之前我也遇到过,并不是这里有问题
解决方案三:
Product product = new Product();
product = gDao.get(Product.class sql id);
String attrnameids = product.getAttrname();
String []attrnameids2 = attrnameids.split(""#"");
for(int i=0;i<attrnameids2.length;i++)
{
description += gDao.qureystr(sql3 attrnameids2[i])+"","";
}
description = description.substring(4 description.length()-1); product.setDescription(description); int fid = product.getFid(); String fname = gDao.qureystr(sql2 fid); product.setFactory(fname); String pic = path+product.getPic(); product.setPic(pic); product.setCount(""1""); System.out.println(""4""); products.add(product); System.out.println(""6""); session.setAttribute(""products"" products);
解决方案四:
Product product = new Product();
product = gDao.get(Product.class sql id);
String attrnameids = product.getAttrname();
String []attrnameids2 = attrnameids.split(""#"");
for(int i=0;i<attrnameids2.length;i++)
{
description += gDao.qureystr(sql3 attrnameids2[i])+"","";
}
description = description.substring(4 description.length()-1); product.setDescription(description); int fid = product.getFid(); String fname = gDao.qureystr(sql2 fid); product.setFactory(fname); String pic = path+product.getPic(); product.setPic(pic); product.setCount(""1""); System.out.println(""4""); products.add(product); System.out.println(""6""); session.setAttribute(""products"" products);
解决方案五:
在执行吗?会一直卡吗?
解决方案六:
什么叫“停下“,你是用什么执行的,建议编译后执行,或者换一个IDE试试看,建议用Eclipse