jsp中,用文本框输入的内容查询mysql中的数据并显示在另一个文本框中. 模糊查询.求救!!!
初学者啊...这是我写的,求指教!<formmethod="post"action="operate.jsp"><inputtype="text"name="search...
初学者啊...这是我写的,求指教!
<form method="post" action="operate.jsp">
<input type="text" name="searchText" value="">
...
String searchText = request.getParameter("searchText");
...
Statement stmt=conn.createStatement();
String sql="SELECT * FROM course where courseName='"+searchText+"'";//模糊查询?
ResultSet rs=stmt.executeQuery(sql);
//(rs.next()){
%>
<input type="text" value=<%=searchText%>>
<input type="text" value=<%=rs.getString("courseName")%>>//想显示搜索结果?
</form> 展开
<form method="post" action="operate.jsp">
<input type="text" name="searchText" value="">
...
String searchText = request.getParameter("searchText");
...
Statement stmt=conn.createStatement();
String sql="SELECT * FROM course where courseName='"+searchText+"'";//模糊查询?
ResultSet rs=stmt.executeQuery(sql);
//(rs.next()){
%>
<input type="text" value=<%=searchText%>>
<input type="text" value=<%=rs.getString("courseName")%>>//想显示搜索结果?
</form> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询