数值转换异常 怎么处理????
页面代码:
<script type="text/javascript">
function getxmlhttp(){
var xmlhttp;
if(window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}else{
//2.fireFox
xmlhttp=new XMLHttpRequest();
}
return xmlhttp;
}
function getclass(){
var xmlhttp=getxmlhttp();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readystate==4){
if(xmlhttp.status==200){
var value=xmlhttp.responseText;
var json=eval("("+value+")");
cls.innerHTML="";
for(var i=0;i<json.length;i++){
var oOption = document.createElement("OPTION");
cls.options.add(oOption);
oOption.innerText = json[i].banji;
oOption.value = json[i].banji;
}
}
}
}
xmlhttp.open("get","<%=basePath%>findallServlet?a="+Math.random(),true);
xmlhttp.send(null);
}
function getinfo(){
var cls=document.getElementById("cls").value;
var km=document.getElementById("km").value;
var xmlhttp=getxmlhttp();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readystate==4){
if(xmlhttp.status==200){
var value=xmlhttp.responseText;
var json=eval("("+value+")");
for(var i=0;i<json.length;i++){
var tu=document.getElementById("tu");
tu.innerHTML=tu.innerHTML+"<div style='float: left;'><div><img width=100px height=100px src='"+"<%=basePath%>/img/"+json[i].pic+"'></div><div>第"+(i+1)+"名 "+json[i].name+" "+json[i].score+"</div></div>"
}
}
}
}
xmlhttp.open("get","<%=basePath%>findinfoServlet?cls="+cls+"&km="+km+"&a="+Math.random(),true);
xmlhttp.send(null);
}
</script>
<body onload="getclass();">
学生成绩查询
班级:<select id="cls">
</select>
科目:<select id="km">
<option value="1">语文</option>
<option value="2">数学</option>
<option value="3">外语</option>
</select>
<input type="button" value="查询" onclick="getinfo();">
<div id="tu">
</div>
</body>
</html>
servlet 代码:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws
ServletException,
IOException {
String json="";
try {
System.out.println(request.getParameter("cls"));