赞
踩
基于javaweb+jsp的个人日记管理系统(JavaWeb MySQL JSP Bootstrap Servlet SSM SpringBoot)
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等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}
/**
* 编辑公告
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("noticeEdit")
public void edit(HttpServletResponse response, HttpServletRequest request) throws IOException {
Notice vo = new Notice();
vo.setId(Long.valueOf(Util.decode(request, "id")));
vo.setNoticeName(Util.decode(request, "noticeName"));
vo.setNoticeText(Util.decode(request, "noticeText"));
public void setPageNum(int pageNum) { this.pageNum = pageNum; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalPage() { return totalPage;
</script> </html> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>日记管理</title> <link rel="stylesheet" type="text/css" href="css/index.css"/> </head> <body> <jsp:include page="menu.jsp"/> <div class="index-content"> <div class="index-content-operation"> <a class="info-detail">日记管理</a>
import java.io.Serializable; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping public class DiaryController { @Autowired private DiaryService diaryService; /** * 增加日记 *
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>修改用户</title> <link rel="stylesheet" type="text/css" href="css/index.css"/> </head> <body> <jsp:include page="menu.jsp"/> <div class="index-content"> <div class="index-content-operation"> <a class="info-detail">修改用户</a> <br> <br> </div> <br> <form action="userEdit" method="post" onsubmit="return check()"> <input type="hidden" id="id" name="id" value="${vo.id}"/> <table class="index-content-table-add"> <tr> <td width="12%">用户名:</td><td><input class="index-content-table-td-add" type="text" id="username" name="username" value="${vo.username}"/></td>
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("userList").forward(request, response); return; } } request.getSession().setAttribute("alert_msg", "错误:用户名或密码错误!"); request.getRequestDispatcher("login.jsp").forward(request, response); } @RequestMapping("authRegister") public void register(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException { String username = Util.decode(request, "username"); String password = Util.decode(request, "password"); System.out.println("username=" + username); System.out.println("password=" + password); Map<String, Object> params = new HashMap(); params.put("searchColumn", "username");//使用`username`字段进行模糊查询 params.put("keyword", username);
<!-- 配置数据源 --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <!--数据库驱动 --> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <!--连接数据库的url --> <property name="url" value="jdbc:mysql://localhost:3306/project_000000000000?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true"></property> <!--连接数据库的用户名 --> <property name="username" value="root"></property> <!--连接数据库的密码 --> <property name="password" value="123456"></property> </bean> <!-- 配置MyBatis工厂SqlSessionFactory --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!--注入数据源 --> <property name="dataSource" ref="dataSource"/> <!--指定核MyBatis心配置文件位置 --> <property name="configLocation" value="classpath:mybatis-config.xml"/> <!--xml文件的路径配置--> <property name="mapperLocations">
<if test ='createDate != null'>`create_date` = #{createDate}</if> </set> WHERE `id` = #{id} </update> <!--获取--> <select id="findById" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM `t_notice` WHERE `id` = #{id} </select> <!--列表--> <select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM `t_notice` <where> <if test="searchColumn != null and searchColumn != '' and keyword != null and keyword != ''"> ${searchColumn} LIKE CONCAT('%',#{keyword},'%') AND </if> 1=1 </where> ORDER BY id ASC <if test="startIndex != null and pageSize != null"> LIMIT #{startIndex},#{pageSize}; </if> </select> <!--数量--> <select id="getAllCount" parameterType="java.util.Map" resultType="Integer"> SELECT COUNT(*) FROM `t_notice`
package com.demo.controller; import com.demo.util.Util; import com.demo.service.UserService; import com.demo.vo.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.io.Serializable; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping public class UserController { @Autowired private UserService userService; /** * 增加用户
<td> <input name="userSex" type="radio" value="男" ${vo.userSex=='男'?'checked':''}/> 男 <input name="userSex" type="radio" value="女" ${vo.userSex=='女'?'checked':''}/> 女 </td> </tr> <tr> <td width="12%">手机:</td><td><input class="index-content-table-td-add" type="text" id="userPhone" name="userPhone" value="${vo.userPhone}"/></td> </tr> <tr> <td width="12%">备注:</td><td><textarea id="userText" name="userText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......">${vo.userText}</textarea></td> </tr> <tr> <td width="12%">类型:</td> <td> <input <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> name="userType" type="radio" value="管理员" ${vo.userType=='管理员'?'checked':''}/> 管理员 <input name="userType" type="radio" value="普通用户" ${vo.userType=='普通用户'?'checked':''}/> 普通用户 </td> </tr> </table> <br>
运行环境
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…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、日记模块的增删改查管理
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。