diff --git a/src/com/hellogithub/dao/projectDao.java b/src/com/hellogithub/dao/projectDao.java index 7bb7359..e7dbd9c 100644 --- a/src/com/hellogithub/dao/projectDao.java +++ b/src/com/hellogithub/dao/projectDao.java @@ -148,7 +148,7 @@ public class projectDao { try { Connection conn = JdbcUtils.getConnection(); QueryRunner runner = new QueryRunner(); - String sql = "SELECT * FROM project WHERE isValid = 1 and projectName LIKE %?%"; + String sql = "SELECT * FROM project WHERE isValid = 1 and projectTitle LIKE \"%\"? \"%\""; projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class), str); conn.close(); } catch (SQLException e) { diff --git a/src/com/hellogithub/servlet/selectByInputServlet.java b/src/com/hellogithub/servlet/selectByInputServlet.java index b8b0737..2e4e095 100644 --- a/src/com/hellogithub/servlet/selectByInputServlet.java +++ b/src/com/hellogithub/servlet/selectByInputServlet.java @@ -45,7 +45,7 @@ public class selectByInputServlet extends HttpServlet { resp.setContentType("application/json;charset=UTF-8"); //添加搜索历史 PrintWriter writer = resp.getWriter(); - String str = req.getParameter("xxxxx"); + String str = req.getParameter("content"); List projectEntityList = projectService.selectByInput(str); HttpSession session = req.getSession(); @@ -59,7 +59,6 @@ public class selectByInputServlet extends HttpServlet { else{ String jsonString = JSONObject.toJSONString(projectEntityList); writer.println(jsonString); - setResultOK("success",writer); } } else{ @@ -72,7 +71,7 @@ public class selectByInputServlet extends HttpServlet { else{ String jsonString = JSONObject.toJSONString(projectEntityList); writer.println(jsonString); - setResultOK("success",writer); + writer.close(); } }