需求:
一个导入按钮,将文件的中的内容处理后写入数据库,
报错如下:
The request was rejected because the URL contained a potentially malicious String "//"
ERROR 7248 — [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
exportBut() {
const loading = this.$loading({
lock: true,
text: '正在导出,请稍等',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
let fields = ''
let titles = ''
this.fieldCheckList.map((item) => {
fields += item.field + ','
titles += item.label + ','
})
const listParams = {
url:'/osTaskApply/getOsTaskData',
fields: fields.slice(0,fields.length-1),
titles: titles.slice(0,titles.length-1),
queryObj: {
}
}
listParams.queryObj = this.genListParams()
postDownLoadExcel('/commonExcel/commonExportExcel', listParams, `任务清单${moment().format("YYYY-MM-DD hh:mm:ss")}.xlsx`).then((res) => {
loading.close()
})
},
似乎这样写没有什么问题,但是在导入过程中报错了.
ERROR 7248 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
The request was rejected because the URL contained a potentially malicious String "//"
提示双斜杠的问题
解决方法就很简单了:
删除连接中的斜线