|
jsp用的公用导入excel页面 webapp/webpage/common/upload/pub_excel_upload.jsp 无论是抛异常还是返回ajaxjson都不起作用
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>通用Excel导入${controller_name}</title>
<t:base type="jquery,easyui,tools"></t:base>
</head>
<body style="overflow-y: hidden" scroll="no">
<t:formvalid formid="formobj" layout="div" dialog="true" beforeSubmit="upload">
<fieldset class="step">
<div class="form"><t:upload name="fiels" buttonText="选择要导入的文件" uploader="${controller_name}.do;jsessionid=${pageContext.session.id}?importExcel=true" extend="*.xls;*.xlsx" id="file_upload" formData="documentTitle"></t:upload></div>
<div class="form" id="filediv" style="height: 50px"></div>
</fieldset>
</t:formvalid>
</body>
</html>
后台正常抛异常返回ajaxjson 无论是抛异常还是返回ajaxjson都不起作用
/**
* 导入功能跳转
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","ceBfCkglController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(CeBfCkglEntity ceBfCkgl, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "添加成功";
try{
_doInsert(ceBfCkgl);
ceBfCkglService.save(ceBfCkgl);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
j.setMsg(e.getMessage());
return j;
// e.printStackTrace();
// message = "添加失败";
// throw new BusinessException(e.getMessage());//无论是抛异常还是返回ajaxjson都不起作用
}
j.setMsg(message);
return j;
}
|
|