基于javaweb+jsp的学籍管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap)

基于javaweb+jsp的学籍管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap)

JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap

基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可

开发工具:eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

        vo.setUsername(Util.decode(request, "username"));
        vo.setPassword(Util.decode(request, "password"));
        vo.setRealName(Util.decode(request, "realName"));
        vo.setUserSex(Util.decode(request, "userSex"));
        vo.setUserPhone(Util.decode(request, "userPhone"));
        vo.setUserText(Util.decode(request, "userText"));
        vo.setUserType(Util.decode(request, "userType"));
        userService.update(vo);
        this.redirectList(request, response);
    }

    /**
     * 获取用户的详细信息(详情页面与编辑页面要显示该用户的详情)并跳转回页面
     *
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping({"userGet", "userEditPre"})
    public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
        Serializable id = Util.decode(request, "id");//取出主键id
    private String userSex;//性别:男/女
    private String userPhone;//手机
    private String userText;//备注
    private String userType;//类型:管理员/普通用户

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * 跳转到列表页面
     *
     * @param request
     * @param response
     */
    private void redirectList(HttpServletRequest request, HttpServletResponse response) throws IOException {
        //查询列和关键字
        String searchColumn = Util.decode(request, "searchColumn");
        String keyword = Util.decode(request, "keyword");
        Map<String, Object> params = new HashMap();//用来保存控制层传进来的参数(查询条件)
        params.put("searchColumn", searchColumn);//要查询的列
        params.put("keyword", keyword);//查询的关键字
        Map<String, Object> map = noticeService.list(params);
        request.getSession().setAttribute("list", map.get("list"));

        Integer totalRecord = (Integer) map.get("totalCount");//根据查询条件取出对应的总记录数,用于分页
            <result column="user_type" property="userType" />
    </resultMap>

    <sql id="Base_Column_List">
        `id`,`username`,`password`,`real_name`,`user_sex`,`user_phone`,`user_text`,`user_type`
    </sql>

    <!--新增-->
    <insert id="doCreate" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.demo.vo.User">
        INSERT INTO `t_user`
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test ='id != null'>`id`,</if>
                    <if test ='username != null'>`username`,</if>
                    <if test ='password != null'>`password`,</if>
                    <if test ='realName != null'>`real_name`,</if>
                    <if test ='userSex != null'>`user_sex`,</if>
                    <if test ='userPhone != null'>`user_phone`,</if>
                    <if test ='userText != null'>`user_text`,</if>
                    <if test ='userType != null'>`user_type`</if>
        </trim>
        if (validationCode != null && !validationCode.equals(request.getSession().getAttribute("validationCode"))) {//验证码不通过
            request.getSession().setAttribute("alert_msg", "错误:验证码不正确!");
            request.getRequestDispatcher("login.jsp").forward(request, response);
            return;
        }

        Map<String, Object> params = new HashMap();
        params.put("searchColumn", "username");//使用`username`字段进行模糊查询
        params.put("keyword", username);
        List<User> list = (List<User>) userService.list(params).get("list");
        for (User user : list) {
            if (user.getUsername().equals(username) && user.getPassword().equals(password)) {//找到这个管理员了
                request.getSession().setAttribute("loginUser", user);
                request.getRequestDispatcher("menu.jsp").forward(request, response);
                return;
            }
        }
        request.getSession().setAttribute("alert_msg", "错误:用户名或密码错误!");
        request.getRequestDispatcher("login.jsp").forward(request, response);
    }

    public void setEnd(int end) {
        this.end = end;
    }

    public String getServlet() {
        return servlet;
    }

    public void setServlet(String servlet) {
        this.servlet = servlet;
    }

    public String getSearchColumn() {
        return searchColumn;
    }

    public void setSearchColumn(String searchColumn) {
        this.searchColumn = searchColumn;
<div class="container-fluid">
    <ul class="nav nav-tabs">
        <li><a href="studentList">学籍列表</a></li>
        <li class="active"><a href="#">编辑</a></li>
    </ul>
    <br/>
    <form class="form-horizontal" role="form" action="studentEdit" method="post" onsubmit="return check()">
        <input type="hidden" class="form-control" id="id" name="id" value="${vo.id}"/>
        
            <div class="form-group">
                <label class="col-sm-3 control-label">学号:</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="studentNo" name="studentNo" value="${vo.studentNo}">
                </div>
            </div>
            <div class="form-group">
            alert("籍贯不能为空!");
            return false;
        }
        if (document.getElementById("studentPhone").value.trim().length == 0) {
            alert("联系方式不能为空!");
            return false;
        }
        if (document.getElementById("studentMajor").value.trim().length == 0) {
            alert("专业不能为空!");
            return false;
        }
        if (document.getElementById("studentClass").value.trim().length == 0) {
            alert("班级不能为空!");
            return false;
        }
        if (document.getElementById("studentLevel").value.trim().length == 0) {
            alert("学历不能为空!");
            return false;
        }
        return true;

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }
}
package com.demo.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.text.SimpleDateFormat;

/**
 * 该方法为通用的工具类,放置一些共用的方法
 */
public class Util {
    /**
     * 获取系统当前时间并格式化为字符串
     *
     * @return
     */
    public static String getTime() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(System.currentTimeMillis());
    }
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名:</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="realName" name="realName" value="${vo.realName}">
                </div>
            </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">性别:</label>
            <div class="col-sm-5">
                       <input name="userSex" type="radio" value="男" ${vo.userSex=='男'?'checked':''}/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                       <input name="userSex" type="radio" value="女" ${vo.userSex=='女'?'checked':''}/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>

运行环境

Java≥6、Tomcat≥7.0、MySQL≥5.5

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

技术框架

JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap

基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

登录、注册、退出、用户模块、公告模块、学籍模块的增删改查管理

20220319000102

20220319000103

20220319000104

20220319000105

20220319000106

20220319000107

20220319000108

20220319000109

20220319000110

document

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值