string index out of range
字符串截取下标越界
出错代码
@GetMAPPing("/edit")
//@requirespermissions("erp:enquirySheet:edit")
public String edit( String enquiryNo,Model model){
EnquirySheetDO enquirySheet = enquirySheetService.selectByEnquiryNo(enquiryNo);
model.addAttribute("enquirySheet",enquirySheet);
//存储sku编号集合
List<EnquiryDetailDO> enquiryDetailList = enquiryDetailService.selectByEntityNo(enquiryNo);
stringbuilder sbu = new StringBuilder();
for(EnquiryDetailDO enquiryDetail : enquiryDetailList){
sbu.append(enquiryDetail.getSkuNo()).append(",");
}
String skuList = sbu.toString().substring(0,(sbu.toString()).length()-1);
model.addAttribute("skuList",skuList);
model.addAttribute("enquiryNo",enquiryNo);
return "erp/enquiry/enquirySheet/edit";
}
修改后代码
@GetMapping("/edit")
//@RequiresPermissions("erp:enquirySheet:edit")
public String edit( String enquiryNo,Model model){
EnquirySheetDO enquirySheet = enquirySheetService.selectByEnquiryNo(enquiryNo);
model.addAttribute("enquirySheet",enquirySheet);
//存储sku编号集合
List<EnquiryDetailDO> enquiryDetailList = enquiryDetailService.selectByEntityNo(enquiryNo);
StringBuilder sbu = new StringBuilder();
if(enquiryDetailList!=null&&enquiryDetailList.size()>0){
for(EnquiryDetailDO enquiryDetail : enquiryDetailList){
sbu.append(enquiryDetail.getSkuNo()).append(",");
}
}
if(sbu!=null&&sbu.length()>0){
String skuList = sbu.toString().substring(0,(sbu.toString()).length()-1);
model.addAttribute("skuList",skuList);
}else{
model.addAttribute("skuList","截取错误");
}
model.addAttribute("enquiryNo",enquiryNo);
return "erp/enquiry/enquirySheet/edit";
}
相关阅读
#目录文章目录#简介格兰杰因果关系作为一种可以衡量时间序列之间相互影响关系的方法,最近十几年备受青睐。无论是经济学[1],气象科
一、前期基础知识储备 首先看几个使用LayoutParams的实例: 1、《Android开发艺术探索》第8章,Java代码中动态设置按钮时 通过Layou
[转]Java图形化界面设计——布局管理器之BorderLayout
边界布局管理器把容器的的布局分为五个位置:CENTER、EAST、WEST、NORTH、SOUTH。依次对应为:上北(NORTH)、下南(SOUTH)、左西(WEST)、右东
c++ ostringstream的用法(c语言的sprintf)
转载: https://blog.csdn.net/qq1987924/article/details/7671154ostringstream的用法【本文来自】http://www.builder.com.cn/20
StringTokenizer:主要用于字符串分隔解析属于:java.util包。1、构造函数。1. StringTokenizer(String str) :构造一个用来解析str的