JAVA WEB try的详细用法 我增加一个就不可以了 求指教

[复制链接]
查看11 | 回复1 | 2021-1-27 05:54:18 | 显示全部楼层 |阅读模式
原代码
publicActionForwardupdateDetailSave(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse)
{
JumboPlatesStockInFormoForm=(JumboPlatesStockInForm)form;
StringpageNo=oForm.getPageNo();
StringpageSize=oForm.getPageSize();
IntegerrecordCount=Integer.parseInt(oForm.getRecordCount());//总共有多少条记录
try
{
jumboPlatesStockInService.updateJumboPlatesStockIn(oForm);
}catch(MPIExceptione)
{
e.printStackTrace();
}catch(Exceptione)
{
e.printStackTrace();
//CommonUtil.remoteAlert(response,"操作失败!\\n"+"异常信息:"+e.getClass()+":"+e.getMessage());
CommonUtil.remoteAlert(response,"提示:操作失败!");
returnnull;
}
Mapmap=null;
try
{
map=jumboPlatesStockInService.findJumboPlatesStockIn(null,null,null,null,null,null,null,oForm.getKeyId(),
null,null,null,null,null,null,null,"1","100",null,null,null,null,null,null,null,null);
}catch(MPIExceptione)
{
e.printStackTrace();
}
recordCount=(Integer)map.get("size");
Listlist=(List)map.get("list");
intnum=recordCount/Integer.parseInt(pageSize);
intpageSum=0;
if(recordCount%Integer.parseInt(pageSize)==0)
{
pageSum=num;
}else
{
pageSum=num+1;
}
request.setAttribute("currentPage",newInteger(pageNo));
request.setAttribute("pageSum",newInteger(pageSum));
request.setAttribute("recordCount",recordCount);
request.setAttribute("JumboPlatesStockInForm",oForm);
request.setAttribute("jumboPlatesStockInList",list);
returnmapping.findForward("jumboPlatesStockIn");
}



更改后
publicActionForwardupdateDetailSave(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse)
{
JumboPlatesStockInFormoForm=(JumboPlatesStockInForm)form;
StringpageNo=oForm.getPageNo();
StringpageSize=oForm.getPageSize();
//Stringdate=oForm.getJumboPlatesStockInDate();
IntegerrecordCount=Integer.parseInt(oForm.getRecordCount());//总共有多少条记录
SimpleDateFormatsdf=newSimpleDateFormat("yyyy-MM-dd");
StringnowDate=sdf.format(newDate());
//当前年月
StringnowYear=nowDate.substring(0,4);
StringnowMounth=nowDate.substring(5,7);
ListreturnList=newArrayList();
booleanflag=false;
try
{
Stringdate=oForm.getJumboPlatesStockInDate();
//补片单年月
Stringyear=date.substring(0,4);
Stringmounth=date.substring(5,7);
if(!nowYear.equals(year)||!nowMounth.equals(mounth))//补片时间和当前时间不是同月
{
returnList.add("警告:入库时间已跨月,不能修改");
}else{
flag=true;
}


try
{
jumboPlatesStockInService.updateJumboPlatesStockIn(oForm);
}catch(MPIExceptione)
{
e.printStackTrace();
}catch(Exceptione)
{
e.printStackTrace();
//CommonUtil.remoteAlert(response,"操作失败!\\n"+"异常信息:"+e.getClass()+":"+e.getMessage());
CommonUtil.remoteAlert(response,"提示:操作失败!");
returnnull;
}
Mapmap=null;
try
{
map=jumboPlatesStockInService.findJumboPlatesStockIn(null,null,null,null,null,null,null,oForm.getKeyId(),
null,null,null,null,null,null,null,"1","100",null,null,null,null,null,null,null,null);
}catch(MPIExceptione)
{
e.printStackTrace();
}
recordCount=(Integer)map.get("size");
Listlist=(List)map.get("list");
intnum=recordCount/Integer.parseInt(pageSize);
intpageSum=0;
if(recordCount%Integer.parseInt(pageSize)==0)
{
pageSum=num;
}else
{
pageSum=num+1;
}
request.setAttribute("currentPage",newInteger(pageNo));
request.setAttribute("pageSum",newInteger(pageSum));
request.setAttribute("recordCount",recordCount);
request.setAttribute("JumboPlatesStockInForm",oForm);
request.setAttribute("jumboPlatesStockInList",list);
returnmapping.findForward("jumboPlatesStockIn");
}

之后会报错
分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:54:18 | 显示全部楼层
javax.servlet.ServletException:java.lang.Error:无法解析的编译问题:
语法错误,将“}”插入到完整Block中
语法错误,将“Finally”插入到完整TryStatement中
错误提示
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行