您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> Java >> 关于for input String:""

关于for input String:""

来源:网络整理     时间:2016/6/26 10:50:38     关键词:

关于网友提出的“ 关于for input String:""”问题疑问,本网通过在网上对“ 关于for input String:""”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: 关于for input String:""
描述:

页面代码: $(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,"修改","书籍"); } }] });       });       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<> 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: ""
/>
求解,哪里写的有问题


解决方案1:

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

解决方案2:

引用 5 楼 initinld 的回复:
引用 1 楼 cai5 的回复:
Action内方法: public void deleteShujis() throws Exception{
HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/html;charset=UTF-8"); try……
是让你看控制台的输出信息, 你把输出贴出来
以上介绍了“ 关于for input String:""”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2081529.html

相关图片

相关文章