为什么resultset next()不执行
<%@ page language="java" import="java.util.*" import="java.sql.*" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查找结果</title>
</head>
<body>
<table align="center" border="1">
<tr><th colspan="4">查找结果</th>
<th colspan="1"><a href='select.jsp'>返回</a></th></tr>
<tr><th>ID</th><th>菜名</th><th>价格</th><th>材料</th><th>食材</th><th>数量</th></tr>
<%
request.setCharacterEncoding("utf-8");
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/java_text?characterEncoding=utf-8","root","123456");
Statement stmt=con.createStatement();
String dishName=request.getParameter("dishName");
String sql="select * from dish where dishName='" + dishName +"'";
ResultSet rs=stmt.executeQuery(sql);
int flag=0;
while(rs.next()){
flag=1;
int dishID=rs.getInt(1);
out.println("<tr><td>"+dishID+"</td><td>"+rs.getString(2)+"</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td><td><a href='edit.jsp?id="+dishID+"'>修改</a> <a href='delete.jsp?id="+dishID+"'>删除</a></td></tr>");
}
if(flag==1){
out.println("<script>alert('查找完成!');</script>");
}else{
out.println("<script>alert('没有找到!');</script>");
response.setHeader("refresh", "1;url=select.jsp");
}
rs.close();
stmt.close();
con.close();
%>
</table>
</body>
</html>