package servlet;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
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 javax.servlet.http.HttpSession;
import dao.*;
import mysql.MysqlUtil;
import pojo.DorInfo;
/**
* Servlet implementation class Search
*/
@WebServlet("/SearchServlet")
public class SearchServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public SearchServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
/*
* response.getWriter().append("Served at: ").append(request.getContextPath());
*/
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
String value = request.getParameter("value");
String selected = request.getParameter("selected");
String table = request.getParameter("table");
HttpSession session = request.getSession();
if (table.equals("dor_info")) {
if (selected.equals("完整查询")) {
if (value == null || value.equals("")) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('值不能为空!');window.location.href='../adminLeft/adminLeftFare.jsp';</script>");
} else {
List dorInfoList = DorInfoDao.readOneList2(name, value);
if (null != dorInfoList && dorInfoList.size() != 0) {
session.setAttribute("dorInfo", dorInfoList);
request.getRequestDispatcher("/adminLeft/adminLeftDorInfo.jsp").forward(request, response);
} else {
List dorInfoList2 = new ArrayList();
dorInfoList2 = DorInfoDao.readList();
session.setAttribute("dorInfo", dorInfoList2);
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('查无此结果!');window.location.href='../adminLeft/adminLeftDorInfo.jsp';</script>");
}
}
} else if (selected.equals("模糊查询")) {
if (value == null || value.equals("")) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('值不能为空!');window.location.href='../adminLeft/adminLeftFare.jsp';</script>");
} else {
List<DorInfo> dorInfoList = DorInfoDao.readOneList2(name, value);
if (null != dorInfoList && dorInfoList.size() != 0) {
session.removeAttribute("dorInfo");
session.setAttribute("dorInfo", dorInfoList);
request.getRequestDispatcher("/adminLeft/adminLeftDorInfo.jsp").forward(request, response);
} else {
List dorInfoList2 = new ArrayList();
dorInfoList2 = DorInfoDao.readList();
session.setAttribute("dorInfo", dorInfoList2);
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('查无此结果!');window.location.href='../adminLeft/adminLeftDorInfo.jsp';</script>");
}
}
}
}
if (table.equals("dor_admin")) {
if (selected.equals("完整查询")) {
if (value == null || value.equals("")) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('值不能为空!');window.location.href='../adminLeft/adminLeftFare.jsp';</script>");
} else {
/*
* System.out.println(name); System.out.println(value);
*/
List dorAdminInfoList = DorAdminInfoDao.readOneList(name, value);
if (null != dorAdminInfoList && dorAdminInfoList.size() != 0) {
session.setAttribute("dorAdminInfo", dorAdminInfoList);
request.getRequestDispatcher("/adminLeft/adminLeftDorAdmin.jsp").forward(request, response);
} else {
List dorAdminInfoList2 = new ArrayList();
dorAdminInfoList2 = DorAdminInfoDao.readList();
session.removeAttribute("dorAdminInfo");
session.setAttribute("dorAdminInfo", dorAdminInfoList2);
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('查无此结果!');window.location.href='../adminLeft/adminLeftDorAdmin.jsp';</script>");
}
}
} else if (selected.equals("模糊查询")) {
if (value == null || value.equals("")) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('值不能为空!');window.location.href='../adminLeft/adminLeftFare.jsp';</script>");
} else {
/*
* System.out.println(name); System.out.println(value);
*/
List dorAdminInfoList = DorAdminInfoDao.readOneList2(name, value);
if (null != dorAdminInfoList && dorAdminInfoList.size() != 0) {
session.setAttribute("dorAdminInfo", dorAdminInfoList);
request.getRequestDispatcher("/adminLeft/adminLeftDorAdmin.jsp").forward(request, response);
} else {
List dorAdminInfoList2 = new ArrayList();
dorAdminInfoList2 = DorAdminInfoDao.readList();
session.removeAttribute("dorAdminInfo");
session.setAttribute("dorAdminInfo", dorAdminInfoList2);
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('查无此结果!');window.location.href='../adminLeft/adminLeftDorAdmin.jsp';</script>");
}
}
}
}
if (table.equals("stu_info")) {
if (selected.equals("完整查询")) {
if (value == null || value.equals("")) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('值不能为空!');window.location.href='../adminLeft/adminLeftFare.jsp';</script>");
} else {
List studentInfoList = StudentInfoDao.readOneList(name, value);
if (null != studentInfoList && studentInfoList.size() != 0) {
session.setAttribute("stuInfo", studentInfoList);
request.getRequestDispatcher("/adminLeft/adminLeftStu.jsp").forward(request, response);
} else {
/*
* System.out.println(name); System.out.println(value);
*/
List studentInfoList2 = new ArrayList();
studentInfoList2 = StudentInfoDao.readList();
session.setAttribute("stuInfo", studentInfoList2);
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('查无此结果!');window.location.href='../adminLeft/adminLeftStu.jsp';</script>");
}
}
} else if (selected.equals("模糊查询")) {
if (value == null || value.equals("")) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('值不能为空!');window.location.href='../adminLeft/adminLeftFare.jsp';</script>");
} else {
List studentInfoList = StudentInfoDao.readOneList2(name, value);
if (null != studentInfoList && studentInfoList.size() != 0) {
session.removeAttribute("stuInfo");
session.setAttribute("stuInfo", studentInfoList);
request.getRequestDispatcher("/adminLeft/adminLeftStu.jsp").forward(request, response);
} else {
/*
* System.out.println(name); System.out.println(value);
*/
List studentInfoList2 = new ArrayList();
studentInfoList2 = StudentInfoDao.readList();
session.setAttribute("stuInfo", studentInfoList2);
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(
"<script>alert('查无此结果!');window.location.href='../adminLeft/adminLeftStu.jsp';</script>");
}
}
}
}
if (table.equals("water_and_electricity")) {
System.out.printl
没有合适的资源?快使用搜索试试~ 我知道了~
基于JavaWeb的宿舍管理系统源码+数据库+毕业设计.zip

共256个文件
js:104个
class:40个
jsp:36个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉

温馨提示
基于JavaWeb的宿舍管理系统源码+数据库+毕业设计.zip,已获高分通过项目,也可作为课程设计、期末大作业。 项目简介 本项目是一套基于JavaWeb的宿舍管理系统,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的Java学习者。 包含:项目源码、数据库脚本、软件工具、项目说明等,该项目可以直接作为毕设使用。 项目都经过严格调试,确保可以运行! 使用说明 1.导入sql文件夹内的sql文件 2.修改项目里的jdbc的相关代码(如数据库账户密码数据库名等),且引入对应mysql版本的包。 3.Tomcat运行项目
资源推荐
资源详情
资源评论























收起资源包目录





































































































共 256 条
- 1
- 2
- 3

程序员张小妍
- 粉丝: 2w+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- PID算法的通俗讲解及调节口诀(17页).doc
- 操作系统哲学家就餐问题课程设计.doc
- 2022秋外研版七上Module10《Spring-Festival》(Unit3).pptx
- 2023年参加安徽农村信用社招聘考试计算机专业面试题.doc
- Q WXJSP 0003 S-2021 烤麸(面筋制品).pdf
- 2022中国邮政网络培训学院.docx
- PMPPMBOK图解项目风险管理.ppt
- 2022中专计算机专业自荐信.docx
- XX工程项目管理规划(前半部分.doc
- DB22_T_2842_2017_消防刑事案件办理规范.pdf
- CAXA软件在机械数控加工的运用.doc
- 2023-2024投资项目管理师之投资建设项目决策名师选题.pdf
- H3CiMC安装部署和软件注册介绍.ppt
- 操作系统PV习题课.ppt
- 2023年浙江大学C语言上机考试题库.doc
- MsProject与IT项目管理.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

- 1
- 2
- 3
- 4
- 5
- 6
前往页