你好,我为一家体育馆开发了一个客户管理应用程序,我希望当我在输入中输入姓名并单击搜索按钮时,它会影响在输入中输入了姓名的客户。但这不起作用,也不会给我任何错误,有人可以帮助我吗
这是我在jsp上的代码:
<%
Connection c=cnx.getcnx();
Statement st=c.createStatement();`enter code here`
ResultSet re=st.executeQuery("select * from client");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display"
rel="stylesheet">
<title>JSP Page</title>
</head>
<body>
<form method="post" action="recherche2" >
<div class="col">
<div class="form-group">
<div class="form-group">
</div>
<label for="exampleInputEmail1">Nom :</label>
<input type="text" class="form-control col-sm-12 col-form-label"
name="nom" aria-describedby="emailHelp" placeholder="Enter votre nom"
id="input">
<input type="submit" value="Rechercher" action="rechercher"
class="button" >
<table class="table table-hover">
<thead>
<tr class="table-active">
<th scope="col">id</th>
<th scope="col">nom</th>
<th scope="col">prenom</th>
<th scope="col">adress</th>
<th scope="col">tel</th>
<th scope="col">Nom de compte</th>
<th scope="col">Mot de passe</th>
</tr>
</thead>
<tbody>
<%while(re.next()){%>
<tr>
<th scope="row"><%=re.getInt(1)%></th>
<td><%=re.getString(2)%></td>
<td><%=re.getString(3)%></td>
<td><%=re.getString(4)%></td>
<td><%=re.getString(5)%></td>
<td><%=re.getString(6)%></td>
</tr>
<%}%>
</tbody>
</table>
</div>
</div>
</form>
</body>
</html>
这是我在servlet上的代码
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
Connection c=cnx.getcnx();
String nom=request.getParameter("nom");
try{
PreparedStatement st=c.prepareStatement("select * from client
where nom=?");
st.setString(1, nom);
ResultSet re1= st.executeQuery();
}
catch(Exception ex){
ex.printStackTrace();
}
getServletContext().getRequestDispatcher("/WEB-
INF/Rechercheclient.jsp").forward(request, response);
}
我的jsp页面如下:
没有报告错误,但是当我单击搜索按钮时它不起作用