基于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("userList")
public void list(HttpServletResponse response, HttpServletRequest request) throws IOException {
this.redirectList(request, response);
}
/**
// 随机获得当前验证码的字符
char codeChar = codeChars.charAt(random.nextInt(charsLength));
validationCode.append(codeChar);
// 随机设置当前验证码字符的颜色
g.setColor(getRandomColor(10, 100));
// 在图形上输出验证码字符,x和y都是随机生成的
g.drawString(String.valueOf(codeChar), 16 * i + random.nextInt(7), height - random.nextInt(6));
}
HttpSession session = request.getSession();
session.setMaxInactiveInterval(5 * 60);
// 将验证码保存在session对象中,key为validation_code
session.setAttribute("validationCode", validationCode.toString());
g.dispose();// 关闭Graphics对象
OutputStream os = response.getOutputStream();
ImageIO.write(image, "JPEG", os);// 以JPEG格式向客户端发送图形验证码
}
@RequestMapping("authResetPassword")
public void resetPassword(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
</tr>
<tr>
<td width="12%">姓名:</td><td><input class="index-content-table-td-add" type="text" id="realName" name="realName" value="${vo.realName}"/></td>
</tr>
<tr>
<td width="12%">性别:</td>
<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>
* @throws IOException
*/
@RequestMapping("shangpingEdit")
public void edit(HttpServletResponse response, HttpServletRequest request) throws IOException {
Shangping vo = new Shangping();
vo.setId(Long.valueOf(Util.decode(request, "id")));
vo.setShangpingName(Util.decode(request, "shangpingName"));
vo.setShangpingText(Util.decode(request, "shangpingText"));
vo.setShangpingJiage(Util.decode(request, "shangpingJiage"));
vo.setShangpingLeimu(Util.decode(request, "shangpingLeimu"));
shangpingService.update(vo);
this.redirectList(request, response);
}
<td width="12%">地址:</td><td><input class="index-content-table-td-add" type="text" id="buyerAddress" name="buyerAddress" value="${vo.buyerAddress}"/></td>
</tr>
<tr>
<td width="12%">订购时间:</td><td><input class="index-content-table-td-add" type="text" id="buyTime" name="buyTime" value="${vo.buyTime}"/></td>
</tr>
<tr>
<td width="12%">价格:</td><td><input class="index-content-table-td-add" type="text" id="cakePrice" name="cakePrice" value="${vo.cakePrice}"/></td>
</tr>
</table>
<br>
<br>
<br>
<button type="submit" class="btn btn-rect btn-grad btn-default btn-sm">提交</button> <button type="button" class="btn btn-rect btn-grad btn-warning btn-sm" onclick="javascript:history.back(-1);">取消</button>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
//根据ID获取值
import javax.servlet.http.HttpSession;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
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"))) {//验证码不通过
request.getSession().setAttribute("alert_msg", "错误:验证码不正确!");
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
</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="userAdd" method="post" onsubmit="return check()">
<table class="index-content-table-add">
<tr>
* @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 = shangpingService.list(params);
request.getSession().setAttribute("list", map.get("list"));
Integer totalRecord = (Integer) map.get("totalCount");//根据查询条件取出对应的总记录数,用于分页
String pageNum = Util.decode(request, "pageNum");//封装分页参数
com.demo.util.PageBean<Object> pb = new com.demo.util.PageBean(Integer.valueOf(pageNum != null ? pageNum : "1"), totalRecord);
params.put("startIndex", pb.getStartIndex());
<a class="info-detail">修改订购</a>
<br>
<br>
</div>
<br>
<form action="orderEdit" 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="cakeName" name="cakeName" value="${vo.cakeName}"/></td>
</tr>
<tr>
<td width="12%">订购人:</td><td><input class="index-content-table-td-add" type="text" id="buyerName" name="buyerName" value="${vo.buyerName}"/></td>
</tr>
<tr>
<td width="12%">性别:</td>
<td>
<input name="buyerSex" type="radio" value="男" ${vo.buyerSex=='男'?'checked':''}/> 男
<input name="buyerSex" type="radio" value="女" ${vo.buyerSex=='女'?'checked':''}/> 女
<input name="buyerSex" type="radio" value="保密" ${vo.buyerSex=='保密'?'checked':''}/> 保密
</td>
</tr>
<tr>
<td width="12%">电话:</td><td><input class="index-content-table-td-add" type="text" id="buyerPhone" name="buyerPhone" value="${vo.buyerPhone}"/></td>
</tr>
<tr>
/**
* 增加用户
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("userAdd")
public void add(HttpServletResponse response, HttpServletRequest request) throws IOException {
User vo = new User();
//取出页面传进来的参数
vo.setUsername(Util.decode(request, "username"));
vo.setPassword(Util.decode(request, "password"));
vo.setRealName(Util.decode(request, "realName"));
<br>
<div class="index-content-operation">
<button class="btn btn-rect btn-grad btn-default btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="window.location.href='user_add.jsp'">添加</button>
<div class="index-content-operation-search"><input id="search_keyword" placeholder="姓名" type="text" name="search_keyword"/><input type="hidden" id="searchColumn" name="searchColumn" value="real_name"/><button class="btn btn-rect btn-grad btn-default btn-sm" onclick="searchList()">搜索</button></div>
</div>
<br>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr class="index-content-table-th">
<th>用户名</th>
<th>姓名</th>
<th>性别</th>
<th>手机</th>
<th>备注</th>
<th>类型</th>
<th>操作</th>
</tr>
</thead>
运行环境
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…均可修改
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、订购模块、蛋糕模块的增删改查管理