宜兴融达二手车市场:!!!JSP 投票页面的问题!!!

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 18:17:33
JSP的投票结果页面有点问题
出问题的源代码如下,请高手指点

//更新投票结果
int first =record.indexOf(":");
int last =record.lastIndexOf(":");
int len = record.length();
String First = record.substring(first+1,last);
String Second = record.substring(first+1,last);
String Third = record.substring(first+1,last);
String Fourth = record.substring(first+1,last);
String Fifth = record.substring(first+1,last);
String Sixth = record.substring(last+1,len);
int a1 = Integer.parseInt(First);
int a2 = Integer.parseInt(Second);
int a3 = Integer.parseInt(Third);
int a4 = Integer.parseInt(Fourth);
int a5 = Integer.parseInt(Fifth);
int a6 = Integer.parseInt(Sixth);

Enumeration names = request.getParameterNames();
while(names.hasMoreElements())
{
String name = (String)names.nextElement();
String value = request.getParameterValues(name)[0];
if(value.compareTo("record01")==0) a1++;
if(value.compareTo("record02")==0) a2++;
if(value.compareTo("record03")==0) a3++;
if(value.compareTo("record04")==0) a4++;
if(value.compareTo("record05")==0) a5++;
if(value.compareTo("record06")==0) a6++;
}//while(names.hasMoreElements())

String b1 = String.valueOf(a1);
String b2 = String.valueOf(a2);
String b3 = String.valueOf(a3);
String b4 = String.valueOf(a4);
String b5 = String.valueOf(a5);
String b6 = String.valueOf(a6);

RAFile_write.writeBytes(b1 + ":" + b2 + ":" + b3 + ":" + b4 + ":" + b5 + ":" + b6);
out.println("record01" + b1 + "record02" + b2 + "record03" + b3 + "record04" + b4 + "record05" + b5 + "record06" + b6);