• 大小: 2.94MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-29
  • 语言: Java
  • 标签: servlet  

资源简介

没有写注释,也没有整理,适合练手,适合初学者,实现了登录,登出,记录来访数,数据库增删改查等功能

资源截图

代码片段和文件信息

package com.menghuan.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.jcp.xml.dsig.internal.MacOutputStream;

import com.alibaba.druid.sql.ast.statement.SQLIfStatement.Else;
import com.menghuan.domain.Equipment;
import com.menghuan.domain.PageUtil;
import com.menghuan.domain.Role;
import com.menghuan.domain.Student;
import com.menghuan.service.StudentService;
import com.menghuan.service.impl.StudentServiceImpl;
import com.menghuan.util.ServiceFactory;
import com.sun.org.apache.bcel.internal.generic.NEW;

public class StudentController extends HttpServlet{
protected void doGet(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
System.out.println(“进入学生信息操作“);
StudentService ss=(StudentService) ServiceFactory.getProxy(new StudentServiceImpl());
String path=request.getServletPath();
if(“/list.do“.equals(path)){
list(requestresponsess);
}else if(“/save.do“.equals(path)){
save(requestresponsess);
}else if(“/delete.do“.equals(path)){
delte(requestresponsess);
}else if(“/edit.do“.equals(path)){
edit(requestresponsess);
}else if(“/update.do“.equals(path)){
update(requestresponsess);
}else if(“/out.do“.equals(path)){
out(requestresponsess);
}else if(“/role.do“.equals(path)){
role(requestresponsess);
}else if(“/equipment.do“.equals(path)){
equipment(requestresponsess);
}

}
private void equipment(HttpServletRequest request HttpServletResponse response StudentService ss) throws IOException {
System.out.println(“进入装备查询操作“);
int rid = Integer.parseInt(request.getParameter(“rid“));
List eList=ss.listEquiment(rid);
StringBuffer sb=new StringBuffer();
//{“id“:?“name“:“?“}}
//{“pList“:[{}{}
sb.append(“{\“eList\“:[“);
for(int i=0;i Equipment e=eList.get(i);
sb.append(“{\“id\“:“);
sb.append(e.getId());
sb.append(“\“name\“:\““);
sb.append(e.getName());
sb.append(“\“}“);
if(i sb.append(““);
}

}
sb.append(“]}“);

System.out.println(sb.toString());
PrintWriter out=response.getWriter();
out.print(sb.toString());
out.close();

}
private void role(HttpServletRequest request HttpServletResponse response StudentService ss) throws IOException {
System.out.println(“进入角色查询操作“);
List rList = ss.listRole();
StringBuffer sb=new StringBuffer();
//{“id“:?“name“:“?“}}
//{“pList“:[{}{}
sb.append(“{\“rList\“:[“);
for(int i=0;i Role r=rList.get(i);
sb.append(“{\“id\“:“);
sb.append(r.getId());
sb.append(“\“name\“:\““);
sb.append(r

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-25 20:21  servlet+jsp\
     目录           0  2018-05-25 20:02  servlet+jsp\crud\
     文件         842  2018-05-22 09:37  servlet+jsp\crud\.classpath
     文件         904  2018-05-22 09:37  servlet+jsp\crud\.project
     目录           0  2018-05-25 20:02  servlet+jsp\crud\.settings\
     文件         567  2018-05-22 09:37  servlet+jsp\crud\.settings\.jsdtscope
     文件         364  2018-05-22 09:37  servlet+jsp\crud\.settings\org.eclipse.jdt.core.prefs
     文件         464  2018-05-22 09:37  servlet+jsp\crud\.settings\org.eclipse.wst.common.component
     文件         345  2018-05-22 09:37  servlet+jsp\crud\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-05-22 09:37  servlet+jsp\crud\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-05-22 09:37  servlet+jsp\crud\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2018-05-25 20:02  servlet+jsp\crud\WebContent\
     目录           0  2018-05-25 20:02  servlet+jsp\crud\WebContent\meta-INF\
     文件          39  2018-05-22 09:37  servlet+jsp\crud\WebContent\meta-INF\MANIFEST.MF
     目录           0  2018-05-25 20:02  servlet+jsp\crud\WebContent\WEB-INF\
     目录           0  2018-05-25 20:02  servlet+jsp\crud\WebContent\WEB-INF\lib\
     文件     2260552  2018-05-21 20:54  servlet+jsp\crud\WebContent\WEB-INF\lib\druid-1.1.0.jar
     文件       20682  2018-05-17 20:12  servlet+jsp\crud\WebContent\WEB-INF\lib\jstl.jar
     文件      566623  2018-04-28 21:52  servlet+jsp\crud\WebContent\WEB-INF\lib\mysql-connector-java-5.1.0-bin.jar
     文件      393259  2018-05-17 20:12  servlet+jsp\crud\WebContent\WEB-INF\lib\standard.jar
     文件        4135  2018-05-22 22:47  servlet+jsp\crud\WebContent\WEB-INF\web.xml
     目录           0  2018-05-25 20:02  servlet+jsp\crud\WebContent\js\
     文件       93637  2018-05-19 09:45  servlet+jsp\crud\WebContent\js\jquery-1.8.3.min.js
     目录           0  2018-05-25 20:02  servlet+jsp\crud\WebContent\jsp\
     文件         951  2018-05-20 18:19  servlet+jsp\crud\WebContent\jsp\add.jsp
     文件        1294  2018-05-22 17:24  servlet+jsp\crud\WebContent\jsp\edit.jsp
     文件        6722  2018-05-23 18:27  servlet+jsp\crud\WebContent\jsp\list.jsp
     文件         862  2018-05-19 17:49  servlet+jsp\crud\WebContent\jsp\taccount.jsp
     文件         997  2018-05-19 20:27  servlet+jsp\crud\WebContent\login.jsp
     目录           0  2018-05-25 20:02  servlet+jsp\crud\build\
     目录           0  2018-05-25 20:02  servlet+jsp\crud\build\classes\
............此处省略76个文件信息

评论

共有 条评论