DaoImpl:
public int muiltDelete(List<Long> ids) {
return getSession().update("com.ningpai.web.dao.TraceLogMapper.deleteMultiByLogId", ids);
}Service:
public int multiDeleteByIds(Long[] ids){
List<Long> list=new ArrayList<Long>();
for(int i=0;i<ids.length;i++){
list.add(ids[i]);
}
return traceLogDao.muiltDelete(list);
}Controller:
@RequestMapping("/multiDeleteTraceLog")
public ModelAndView multiDelete(HttpServletResponse response,Long[] Id){
PrintWriter pr=null;
try {
response.setContentType(Constant.REQ_SETCONTENT);
pr=response.getWriter();
pr.print(traceLogService.multiDeleteByIds(Id));
} catch (IOException e) {
return new ModelAndView(Constant.REQ_VIEW);
}finally{
if(pr!=null){
pr.close();
}
}
return null;
}SQL语句:
<update id="deleteMultiByLogId">
UPDATE trace_log SET delete_flag='1' WHERE
<foreach collection="list" separator="or" item="mid" index="index" >
(id = #{mid,jdbcType=BIGINT})
</foreach>
</update>运行批量删除后报错:
Resolving exception from handler [com.ningpai.web.productrecord.controller.TraceLogController@335578c5]: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long[]'; nested exception is java.lang.NumberFormatException: For input string: "undefined"求各位大神帮小弟看一下,是哪儿错了,拜谢!异常
public int muiltDelete(List<Long> ids) {
return getSession().update("com.ningpai.web.dao.TraceLogMapper.deleteMultiByLogId", ids);
}Service:
public int multiDeleteByIds(Long[] ids){
List<Long> list=new ArrayList<Long>();
for(int i=0;i<ids.length;i++){
list.add(ids[i]);
}
return traceLogDao.muiltDelete(list);
}Controller:
@RequestMapping("/multiDeleteTraceLog")
public ModelAndView multiDelete(HttpServletResponse response,Long[] Id){
PrintWriter pr=null;
try {
response.setContentType(Constant.REQ_SETCONTENT);
pr=response.getWriter();
pr.print(traceLogService.multiDeleteByIds(Id));
} catch (IOException e) {
return new ModelAndView(Constant.REQ_VIEW);
}finally{
if(pr!=null){
pr.close();
}
}
return null;
}SQL语句:
<update id="deleteMultiByLogId">
UPDATE trace_log SET delete_flag='1' WHERE
<foreach collection="list" separator="or" item="mid" index="index" >
(id = #{mid,jdbcType=BIGINT})
</foreach>
</update>运行批量删除后报错:
Resolving exception from handler [com.ningpai.web.productrecord.controller.TraceLogController@335578c5]: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long[]'; nested exception is java.lang.NumberFormatException: For input string: "undefined"求各位大神帮小弟看一下,是哪儿错了,拜谢!异常
解决方案 »
- 疯了,log4j,用的slf的api和转换适配器
- $如何获取select的长度
- 我想读源码,如何使用power designer进行反向工程,即可得到其类关系的“鸟瞰图”,具体怎么做
- 如何提取word文档中的内容显示在web页面上?
- 一个简单的SQL插入语句
- jboss 配置 oracle 数据源
- 武汉J2EE程序员联盟,群号9746447,欢迎武汉的朋友,或在武汉工作的朋友进来交流。
- ENCTYPE="multipart/form-data"传过来的数据,可不可以得到上个页面中的text中的值呢?
- 請問java在web中如何調用Crystal Reports 10作打印?
- 这个问题是不是太弱智了,没有人回答^_^
- SSH2 服务器的保留值,不清空的问题
- 我靠 java打印 全是从网站上copy过来的代码 怎么不行啊
Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long[]'; nested exception is java.lang.NumberFormatException: For input string: "undefined"
这里说错误是你想把undefined转化为long的形式,所以出错,
我猜应该是你某个值未赋值,所以前台页面默认添加了undefined