博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【FAQ问题记录】 File "/webpage/a/mds/mdsquota/mdsQuotaDetail/template.jsp" not found
阅读量:4186 次
发布时间:2019-05-26

本文共 1921 字,大约阅读时间需要 6 分钟。

 在开发ERP系统下载模板问题时,控制台报错如下:

     File "/webpage/a/mds/mdsquota/mdsQuotaDetail/template.jsp" not found

   出现这个问题的原因是因为controller中用了两次response响应到前台来。

 出错前代码如下:

@RequiresPermissions("mds:mdsquota:mdsQuota:import")	@RequestMapping(value = "template")	public String  getFileTemplate(String id,HttpServletResponse response,RedirectAttributes redirectAttributes) {		try {			String fileName ="材料定额数据导入模板.xlsx";			String title="红色字体为必填字段,序号和单台定额必须为整数,备注信息不能超过50个字";			List
headerList = new ArrayList<>(); //示例数据 List
exampleList = new ArrayList<>(); new ExportExcel().insertList(headerList, exampleList).createExcel(title,headerList,exampleList).write(response,fileName).dispose(); addMessage(redirectAttributes,"模板下载成功"); } catch (Exception e) { addMessage(redirectAttributes,"模板下载失败!失败信息:"+e.getMessage()); } return "redirect:"+Global.getAdminPath()+"/mds/mdsquota/mdsQuota/edit?id="+id; }

    在这段代码中 最后发起转发前,程序已经通过response(new ExportExcel().insertList(headerList, exampleList).createExcel(title,headerList,exampleList).write(response,fileName).dispose();),响应到了前端,所以发生了控制台那样的报错。

        最后还是在转发之前发通过return null,解决的报错。

@RequiresPermissions("mds:mdsquota:mdsQuota:import")	@RequestMapping(value = "template")	public String  getFileTemplate(String id,HttpServletResponse response,RedirectAttributes redirectAttributes) {		try {			String fileName ="材料定额数据导入模板.xlsx";			String title="红色字体为必填字段,序号和单台定额必须为整数,备注信息不能超过50个字";			List
headerList = new ArrayList<>(); //示例数据 List
exampleList = new ArrayList<>(); new ExportExcel().insertList(headerList, exampleList).createExcel(title,headerList,exampleList).write(response,fileName).dispose(); addMessage(redirectAttributes,"模板下载成功"); return null; } catch (Exception e) { addMessage(redirectAttributes,"模板下载失败!失败信息:"+e.getMessage()); } return "redirect:"+Global.getAdminPath()+"/mds/mdsquota/mdsQuota/edit?id="+id; }

 

转载地址:http://lcfoi.baihongyu.com/

你可能感兴趣的文章
CareerCup Sort an array in a special way
查看>>
CareerCup Find lexicographic minimum in a circular array 循环数组字典序
查看>>
CareerCup Cost of cutting wood
查看>>
Find the number of subsets such that the sum of numbers in the subset is a prime number
查看>>
CareerCup Binary Tree the Maximum of 人
查看>>
CareerCup Divide n cakes to k different people
查看>>
CareerCup Randomly return a node in a binary tree
查看>>
CareerCup Given a sorted array which contains scores. Write a program to find occurrence
查看>>
CareerCup The number of pairs (x, y) of distinct elements with condition x + y <= Threshold
查看>>
Build a key-value data structure which can perform lookup and rangeLookup(key1, key2)
查看>>
整数划分问题---动态规划、递归
查看>>
Balanced Partition
查看>>
Number of 1s
查看>>
CareerCup Find all the conflicting appointments from a given list of n appointments.
查看>>
CareerCup Given an array having positive integers, find a subarray which adds to a given number
查看>>
CareerCup Generate all the possible substrings
查看>>
CareerCup Given an array A[], find (i, j) such that A[i] < A[j] and (j - i) is maximum.
查看>>
Brain Teaser 球变色
查看>>
(2)考试大纲---信息系统项目管理师考试系列
查看>>
(3)教材目录---信息系统项目管理师考试系列
查看>>