JSP文件:[/testSouSuo.jsp] 的第 [68] 行发生了一个错误 The operator + is undefined for the argument type(s) String 65: // 鎵ц鏌ヨ绛夋搷浣� 66: 67: //select ZYName,YLName,YDY,YX,GX,ZhongYao.ZZ as ZZ from Yaolei,ZhongYao where Yaolei.YLID=ZhongYao.YLID and ZYName like '%name%' 68: String sql = "select ZYName,YLName,YDY,YX,GX,ZhongYao.ZZ as ZZ from Yaolei,ZhongYao where Yaolei.YLID=ZhongYao.YLID and ZYName like '"%+name+"%'";
时间: 2024-03-04 21:48:03 浏览: 203
quay.io/tigera/operator:v1.20.3
根据错误提示,第68行的语句出现了问题,因为在字符串连接时使用了加号运算符,但是加号运算符不能用于连接字符串。建议在连接字符串时使用字符串拼接函数,如String.format()或StringBuilder类。您可以尝试将第68行的语句修改为以下内容:
```
String sql = String.format("select ZYName,YLName,YDY,YX,GX,ZhongYao.ZZ as ZZ from Yaolei,ZhongYao where Yaolei.YLID=ZhongYao.YLID and ZYName like '%%%s%%'", name);
```
或者
```
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("select ZYName,YLName,YDY,YX,GX,ZhongYao.ZZ as ZZ from Yaolei,ZhongYao where Yaolei.YLID=ZhongYao.YLID and ZYName like '%");
sqlBuilder.append(name);
sqlBuilder.append("%'");
String sql = sqlBuilder.toString();
```
阅读全文