基于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等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
<input type="password" class="input input-big" name="password" id="password" placeholder="登录密码" />
<span class="icon icon-key margin-small"></span>
</div>
</div>
<div class="form-group">
<div class="field field-icon-right">
<input type="text" class="input input-big" name="validationCode" id="validationCode" placeholder="请输入验证码" style="width: 180px;float: left;"/>
<img id="img_validation_code" src="authValidationCode" onclick="refresh()" style="height: 44px;width: 150px;float: right;border-radius: 4px;"/>
</div>
</div>
</div>
<br><br>
<div style="padding:30px;">
<input type="submit" class="button button-block bg-main text-big input-big" value="登录">
</div>
</div>
</form>
</div>
</div>
</div>
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
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);
}
@RequestMapping("authRegister")
public void register(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
@Controller
public class AuthController extends HttpServlet {
@Autowired
private UserService userService;
@RequestMapping("authLogin")
public void login(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
String username = Util.decode(request, "username");
String password = Util.decode(request, "password");
String validationCode = Util.decode(request, "validationCode");
if (validationCode != null && !validationCode.equals(request.getSession().getAttribute("validationCode"))) {//验证码不通过
public void setUserType(String userType) {
this.userType = userType;
}
}
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>订购编辑</title>
<%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
public void setSearchColumn(String searchColumn) {
this.searchColumn = searchColumn;
}
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 {
/**
* 获取系统当前时间并格式化为字符串
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 NoticeController {
@Autowired
private NoticeService noticeService;
/**
* 增加公告
e.printStackTrace();
}
System.out.println(parameterName + "==" + str.trim());
return str.trim();
}
}
package com.demo.vo;
import java.io.Serializable;
/**
* 订购(t_order表对应的Java实体类)
*/
public class Order implements Serializable {
private Long id;//主键
private String cakeName;//商品名
}
public int getTotalRecord() {
return totalRecord;
}
public void setTotalRecord(int totalRecord) {
this.totalRecord = totalRecord;
}
//--分页逻辑
//已知数据
private int pageNum;//当前页,从请求那边传过来。
private int pageSize;//每页显示的数据条数。
//需要计算得来
private int totalPage; //总页数,通过totalRecord和pageSize计算可以得来
//开始索引,也就是我们在数据库中要从第几行数据开始拿,有了startIndex和pageSize,
//就知道了limit语句的两个数据,就能获得每页需要显示的数据了
private int startIndex;
//分页显示的页数,比如在页面上显示1,2,3,4,5页,start就为1,end就为5,这个也是算过来的
private int start;
private int end;
* @param request
* @throws IOException
*/
@RequestMapping("shangpingDelete")
public void delete(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");
shangpingService.delete(Arrays.asList(id));
this.redirectList(request, response);
}
/**
* 编辑蛋糕
*
* @param response
* @param request
* @throws IOException
<delete id="doRemoveBatch" parameterType="java.util.Collection">
DELETE FROM `t_notice` WHERE `id` IN
<foreach collection="list" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<!--修改-->
<update id="doUpdate" parameterType="com.demo.vo.Notice">
UPDATE `t_notice`
<set>
<if test ='id != null'>`id` = #{id},</if>
<if test ='noticeName != null'>`notice_name` = #{noticeName},</if>
<if test ='noticeText != null'>`notice_text` = #{noticeText},</if>
<if test ='noticeType != null'>`notice_type` = #{noticeType},</if>
<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>
运行环境
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…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、订购模块、蛋糕模块的增删改查管理