Resource specification not allowed here for source level below 1.7

An error occurred at line: 34 in the jsp file: /pages/hbt/hjxf/ajaxYubei.jsp
Resource specification not allowed here for source level below 1.7
31:     String FlowId = request.getParameter("flowid");
32:     //读取json 
33:     StringBuilder sb = new StringBuilder();
34:     try (BufferedReader reader = request.getReader())   
35:         char[] buff = new char[1024];
36:         int len;
37:         while ((len = reader.read(buff)) != -1) {

34行报错,此问题是因为try里面加语句的写法在source level 1.7及其以下的版本是不支持的。把try()括号里面的语句写到下面即可。

标签: Java

添加新评论