日期:2014-05-17  浏览次数:21177 次

关于for input String:""
页面代码:<script type="text/javascript" src="js/jquery-1.6.js"></script>
<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
$(document).ready(function() {
initCommonJS();
$("#gridTable").datagrid({
url:'fetchShujiList.action?t=' + new Date(),
width:750,
sortName: 'name',
sortOrder: 'desc',
pagination:true,
rownumbers:true,
pageList:[15,30,50,100],
columns:[[
{field:'bookid',title:'书籍编号',width:30,hidden:true},
{field:'ck',checkbox:true,width:30},
{field:'bookname',title:'书籍名称',width:80,sortable:true},
{field:'autor',title:'作者',width:60,align:'center',sortable:true}
]],
toolbar:[{
id:'btnadd',
text:'添加',
iconCls:'icon-add',
handler:function(){
checkOpenUrl("#gridTable","shujidit.html",550,420,"添加","书籍");
}
},{
id:'btnremove',
text:'删除',
iconCls:'icon-remove',
handler:function(){
checkSelectSomeDoFunc("#gridTable","删除","书籍",
function(ids){
$.post("deleteShujis.action?selectedIds="+ids+"&t="+new Date(),{},function(result){
if (result=="success"){
$("#gridTable").datagrid("reload");
}else{
alert(result);
}
});
},
true
);
}
},{
id:'btnedit',
text:'修改',
iconCls:'icon-edit',
handler:function(){
checkSelectOneOpenUrl("#gridTable","shujidit.html",550,420,"修改","书籍");
}
}]
});
  });
 
</script>
</head>
<body>
<table id="gridTable"></table>
</body>

Action内方法:
public void deleteShujis() throws Exception{
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/html;charset=UTF-8");
try{
String[] ids = this.selectedIds.split(",");
for (int i=0;i<ids.length;i++){
this.shujiService.delete(Integer.valueOf(ids[i]));
}
response.getWriter().write("success");
}catch(Exception ex){
System.out.println(ex);
response.getWriter().write("删除书籍出错!");
}
}
数据库字段分别是
int bookid;
String bookname;
String autor;

错误信息:java.lang.NumberFormatException: For input string: ""

求解,哪里写的有问题

------解决方案--------------------
探讨
引用:
Action内方法:
public void deleteShujis() throws Exception{
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/html;charset=UTF-8");
try……

------解决方案--------------------
你看2楼和3楼叫你加的输出语句,主要是看那2条输出语句的结果 ,然后解决问题,其实猜都能猜到ids[i]有个值是空