代码拉取完成,页面将自动刷新
package com.qf.admin.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import com.qf.bean.User;
import com.qf.service.UserService;
import com.qf.service.impl.UserServiceImpl;
@WebServlet("/searchUser")
public class SearchUser extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
String username = req.getParameter("username");
String gender = req.getParameter("gender");
UserService service = new UserServiceImpl();
List<User> list = service.searchUser(username, gender);
if(list!=null){
String json = new Gson().toJson(list);
resp.getWriter().print(json);
}else{
resp.getWriter().print(0);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doGet(req, resp);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。