关于动态数组的请教----20 我测试了一下,没有出错,但是要改一下: while(it.hasNext()) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的完整的过程是这样的,但是有异常 public String checkData(ActionForm form, HttpServletRequest request) { String list =""; String newProductCode="GCX"; String oldProductCode=null; Collection col=new Vector(); col.add(newProductCode); Iterator it= col.iterator(); PurchaseForm listForm = (PurchaseForm)form; for(int i = 0; i < listForm.getSize(); i++) { if (!StringUtil.isEmpty(listForm.get(i).getProductID())) { newProductCode=listForm.get(i).getProductCode(); while (it.hasNext()) { oldProductCode=((String) it.next()); if (newProductCode.equals(oldProductCode.toString())) { list=list+"一张单据不能开相同的品种!"; break; } } if (("".equals(list))) col.add(newProductCode); if ((Double.parseDouble(listForm.get(i).getQuantin())<=0) || (Double.parseDouble(listForm.get(i).getPrice()))<=0) { list=list+listForm.get(i).getProductDesc()+" 数量或单价不能为0"; break; } } } return list; } 我给oldProductCode=((String) it.next());语句加了try ...catch语句,好象就变成了死循环 请教:jsp备份恢复mysql数据库出错 html:optionsCollection 感觉有难度,不信来瞧瞧--图片如何实现任转任意角度显示? 2个STRUTS问题 java QQ群 只限在北京做java web的朋友 类型转换和页面相加问题!~请教高手。 提交数据时Tomcat无法找到我的Servlet 免费源代码下载。 什么是jsp?50分。 请教一个关于取得参数值的的函数!! 不能启动weblogic 在jsp中怎么取参数?
public String checkData(ActionForm form, HttpServletRequest request)
{
String list ="";
String newProductCode="GCX";
String oldProductCode=null;
Collection col=new Vector();
col.add(newProductCode); Iterator it= col.iterator();
PurchaseForm listForm = (PurchaseForm)form;
for(int i = 0; i < listForm.getSize(); i++)
{
if (!StringUtil.isEmpty(listForm.get(i).getProductID()))
{
newProductCode=listForm.get(i).getProductCode(); while (it.hasNext())
{ oldProductCode=((String) it.next()); if (newProductCode.equals(oldProductCode.toString()))
{
list=list+"一张单据不能开相同的品种!";
break;
}
}
if (("".equals(list)))
col.add(newProductCode); if ((Double.parseDouble(listForm.get(i).getQuantin())<=0) || (Double.parseDouble(listForm.get(i).getPrice()))<=0)
{
list=list+listForm.get(i).getProductDesc()+" 数量或单价不能为0";
break;
}
}
}
return list;
}