• 大小: 4.73MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-19
  • 语言: Java
  • 标签: java  

资源简介

java语言的班级管理系统的设计与开发java语言的班级管理系统的设计与开发

资源截图

代码片段和文件信息

package com.action;

import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.DB;
import com.orm.TAdmin;

public class admin_servlet extends HttpServlet
{
public void service(HttpServletRequest reqHttpServletResponse res)throws ServletException IOException 
{
        String type=req.getParameter(“type“);

if(type.endsWith(“adminMana“))
{
adminMana(req res);
}
if(type.endsWith(“adminAdd“))
{
adminAdd(req res);
}
if(type.endsWith(“adminDel“))
{
adminDel(req res);
}
}

public void adminMana(HttpServletRequest reqHttpServletResponse res) throws ServletException IOException
{
List adminList=new ArrayList();
String sql=“select * from t_admin“;
object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TAdmin admin=new TAdmin();
admin.setUserId(rs.getInt(“userId“));
admin.setUserName(rs.getString(“userName“));
admin.setUserPw(rs.getString(“userPw“));
adminList.add(admin);
    }
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();

req.setAttribute(“adminList“ adminList);
req.getRequestDispatcher(“admin/admin/adminMana.jsp“).forward(req res);
}
public void adminAdd(HttpServletRequest reqHttpServletResponse res)
{
String userName=req.getParameter(“userName“);
String userPw=req.getParameter(“userPw“);
String sql=“insert into t_admin values(??)“;
object[] params={userNameuserPw};
DB mydb=new DB();
mydb.doPstm(sql params);
mydb.closed();

req.setAttribute(“message“ “操作成功“);
req.setAttribute(“path“ “admin?type=adminMana“);

        String targetURL = “/common/success.jsp“;
dispatch(targetURL req res);
}

public void adminDel(HttpServletRequest reqHttpServletResponse res)
{
System.out.println(req.getParameter(“userId“)+“**“);
String sql=“delete from t_admin where userId=“+Integer.parseInt(req.getParameter(“userId“));
object[] params={};
DB mydb=new DB();
mydb.doPstm(sql params);
mydb.closed();

req.setAttribute(“message“ “操作成功“);
req.setAttribute(“path“ “admin?type=adminMana“);

        String targetURL = “/common/success.jsp“;
dispatch(targetURL req res);
}

public void dispatch(String targetURIHttpServletRequest requestHttpServletResponse response) 
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try 
{
    dispatch.forward(request response);
    return;

catch (ServletException e) 
{
                    e.printStackTrace();


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件     1048576  2016-04-30 16:54  db_banji_Data.MDF
     文件     1048576  2016-04-30 16:54  db_banji_Log.LDF
     目录           0  2017-11-26 08:39  banji\
     文件        1704  2017-12-15 17:32  banji\.classpath
     目录           0  2017-12-16 22:32  banji\.myeclipse\
     文件         288  2017-12-15 17:32  banji\.mymetadata
     文件        1748  2017-12-15 17:33  banji\.project
     目录           0  2017-12-15 17:33  banji\.settings\
     文件         500  2017-12-15 17:33  banji\.settings\.jsdtscope
     文件         100  2012-02-09 01:08  banji\.settings\org.eclipse.core.resources.prefs
     文件         629  2017-12-16 22:04  banji\.settings\org.eclipse.jdt.core.prefs
     文件         453  2017-12-15 17:32  banji\.settings\org.eclipse.wst.common.component
     文件         252  2017-12-15 17:33  banji\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-12-15 17:33  banji\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-12-15 17:33  banji\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-11-26 08:39  banji\WebRoot\
     目录           0  2017-11-26 08:39  banji\WebRoot\meta-INF\
     文件          39  2012-02-09 01:08  banji\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2017-11-26 08:39  banji\WebRoot\My97DatePicker\
     文件        1389  2012-02-09 01:08  banji\WebRoot\My97DatePicker\My97DatePicker.htm
     文件        8367  2012-02-09 01:08  banji\WebRoot\My97DatePicker\WdatePicker.js
     文件       20471  2012-02-09 01:08  banji\WebRoot\My97DatePicker\calendar.js
     文件         223  2012-02-09 01:08  banji\WebRoot\My97DatePicker\config.js
     目录           0  2017-11-26 08:39  banji\WebRoot\My97DatePicker\lang\
     文件         644  2012-02-09 01:08  banji\WebRoot\My97DatePicker\lang\en.js
     文件        1089  2012-02-09 01:08  banji\WebRoot\My97DatePicker\lang\zh-cn.js
     文件        1088  2012-02-09 01:08  banji\WebRoot\My97DatePicker\lang\zh-tw.js
     目录           0  2017-11-26 08:39  banji\WebRoot\My97DatePicker\skin\
     文件         158  2012-02-09 01:08  banji\WebRoot\My97DatePicker\skin\WdatePicker.css
     文件        1043  2012-02-09 01:08  banji\WebRoot\My97DatePicker\skin\datePicker.gif
     目录           0  2017-11-26 08:39  banji\WebRoot\My97DatePicker\skin\default\
............此处省略845个文件信息

评论

共有 条评论