基于javaweb+jsp的实验室管理系统(带报告文档)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
pb.setList(list);
request.getSession().setAttribute("pageBean", pb);
request.getSession().setAttribute("list", pb.getList());
response.sendRedirect("shebei_list.jsp");
}
}
package com.demo.controller;
import com.demo.util.Util;
import com.demo.service.ShiyanshiService;
import com.demo.vo.Shiyanshi;
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;
<input type="text" class="form-control" name="weixiuName" id="edit-weixiuName">
</div>
<div class="form-group">
<label for="edit-weixiuShiyanshi" class="control-label">所属实验室:</label>
<input type="text" class="form-control" name="weixiuShiyanshi" id="edit-weixiuShiyanshi">
</div>
<div class="form-group">
<label for="edit-weixiuBaoxiuren" class="control-label">报修人:</label>
<input type="text" class="form-control" name="weixiuBaoxiuren" id="edit-weixiuBaoxiuren">
</div>
<div class="form-group">
<label for="edit-weixiuYuanyin" class="control-label">报修原因:</label>
<input type="text" class="form-control" name="weixiuYuanyin" id="edit-weixiuYuanyin">
</div>
<div class="form-group">
<label class="control-label">状态:</label>
<input name="weixiuZhuangtai" id="edit-weixiuZhuangtai_维修完成" type="radio" value="维修完成"/>维修完成
<input name="weixiuZhuangtai" id="edit-weixiuZhuangtai_待处理" type="radio" value="待处理"/>待处理
</div>
<div class="form-group">
<label for="edit-weixiuBaoxiushjjian" class="control-label">报修时间:</label>
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS);
}
/**
* 判断字符串是否是乱码
*
* @param strName
* @return
*/
public static boolean isMessyCode(String strName) {
java.util.regex.Pattern p = java.util.regex.Pattern.compile("\\s*|\t*|\r*|\n*");
java.util.regex.Matcher m = p.matcher(strName);
str = new String(str.getBytes("GBK"), "UTF-8");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("UTF-8"), "ISO-8859-1");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GB2312"), "ISO-8859-1");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GBK"), "ISO-8859-1");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("UTF-8"), "GB2312");
}
if (isMessyCode(str)) {
<label for="add-weixiuWeixiuren" class="control-label">维修人:</label>
<input type="text" class="form-control" name="weixiuWeixiuren" id="add-weixiuWeixiuren">
</div>
<div class="form-group">
<label for="add-weixiuWeixiushijian" class="control-label">维修时间:</label>
<input type="text" class="form-control" name="weixiuWeixiushijian" id="add-weixiuWeixiushijian">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-line btn-info" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-line btn-success">提交</button>
</div>
</form>
</div>
</div>
</div>
<!-- info -->
<div class="modal fade" id="modal-info" tabindex="-1" role="dialog"
// 保存minColor最大不会超过255
if (maxColor > 255)
maxColor = 255;
// 获得红色的随机颜色值
int red = minColor + random.nextInt(maxColor - minColor);
// 获得绿色的随机颜色值
int green = minColor + random.nextInt(maxColor - minColor);
// 获得蓝色的随机颜色值
int blue = minColor + random.nextInt(maxColor - minColor);
return new Color(red, green, blue);
}
}
package com.demo.controller;
import com.demo.util.Util;
import com.demo.service.WeixiuService;
import com.demo.vo.Weixiu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
<input type="text" class="form-control" name="id" id="delete-id">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-line btn-info" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-line btn-success">删除</button>
</div>
</form>
</div>
</div>
</div>
</body>
<script>
$('#modal-delete').on('show.bs.modal', function (event) {
let button = $(event.relatedTarget);
let id = button.data('id');
let modal = $(this);
modal.find('#delete-id').val(id);
})
@RequestMapping("authLogout")
public void logout(HttpServletResponse response, HttpServletRequest request) throws IOException {
HttpSession session = request.getSession();
User user = (User) session.getAttribute("loginUser");
if (user != null) {
session.removeAttribute("loginUser");
}
response.sendRedirect("login.jsp");
}
@RequestMapping("authValidationCode")
public void validationCode(HttpServletResponse response, HttpServletRequest request) throws IOException {
String codeChars = "0123456789";// 图形验证码的字符集合,系统将随机从这个字符串中选择一些字符作为验证码
// 获得验证码集合的长度
int charsLength = codeChars.length();
// 下面三条记录是关闭客户端浏览器的缓冲区
// 这三条语句都可以关闭浏览器的缓冲区,但是由于浏览器的版本不同,对这三条语句的支持也不同
// 因此,为了保险起见,建议同时使用这三条语句来关闭浏览器的缓冲区
response.setHeader("ragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
// 设置图形验证码的长和宽(图形的大小)
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.demo.dao.ShebeiMapper">
<resultMap id="BaseResultMap" type="com.demo.vo.Shebei" >
<result column="id" property="id" />
<result column="shebei_name" property="shebeiName" />
<result column="shebei_shiyanshi" property="shebeiShiyanshi" />
<result column="shebei_shuliang" property="shebeiShuliang" />
<result column="shebei_zhuangtai" property="shebeiZhuangtai" />
<result column="shebei_text" property="shebeiText" />
</resultMap>
<sql id="Base_Column_List">
`id`,`shebei_name`,`shebei_shiyanshi`,`shebei_shuliang`,`shebei_zhuangtai`,`shebei_text`
</sql>
<!--获取-->
<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>
<!--数量-->
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 ShiyanshiController {
@Autowired
private ShiyanshiService shiyanshiService;
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、设备模块、实验室模块、维修模块的增删改查管理