Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
钱继志 committed May 30, 2018
1 parent 93a93db commit 7751973
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 33 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/lesson/controller/OrderEntryControllor.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

@Controller
@RequestMapping("/order")
public class OrderEntryControllor {
@Autowired
MenuManager menuManager;
Expand Down Expand Up @@ -185,13 +185,14 @@ public String saveMenu(Model model,
@RequestMapping(value = "/delete/{mid}", method = RequestMethod.GET) //按照ID展示
public String deleteMenu(Model model,
@PathVariable int mid,
HttpServletRequest request) {
HttpServletRequest request,
HttpServletResponse response) {
menuManager.deleteMenuByMid(mid); //删除对应menu

HttpSession session = request.getSession();
model.addAttribute("menus", menuManager.getAllMenus());
session.setAttribute("categoryManager", categoryManager);
// return "jsp/menuList.jsp";

return "/showMenus";
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/sql/order.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE DATABASE IF NOT EXISTS `order` /*!40100 DEFAULT CHARACTER SET utf8 */;
CREATE DATABASE IF NOT EXISTS `order`
USE `order`;

DROP TABLE IF EXISTS `categories`;
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<jsp:forward page="order/showMenus"></jsp:forward>
<jsp:forward page="/showMenus"></jsp:forward>
</html>
4 changes: 2 additions & 2 deletions src/main/webapp/jsp/categoryAdd.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<body>
<h2>添加菜品分类</h2>
<form action="/order/saveCategory" method = "post">
<form action="/saveCategory" method = "post">
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>菜品分类名称</th>
Expand All @@ -27,7 +27,7 @@
<br>
<input type = "submit" value = "添加"/>
&nbsp;
<input type = "button" value = "取消" onclick="window.location.href='/order/showCategories'"/>
<input type = "button" value = "取消" onclick="window.location.href='/showCategories'"/>
</form>

</body>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/jsp/categoryEdit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<h2>编辑菜品分类</h2>

<form action="/order/saveCategory" method = "post">
<form action="/saveCategory" method = "post">
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>菜品分类ID</th>
Expand All @@ -27,7 +27,7 @@
<br>
<input type = "submit" value = "提交修改"/>
&nbsp;
<input type = "button" value = "取消" onclick="window.location.href='/order/showCategories'"/>
<input type = "button" value = "取消" onclick="window.location.href='/showCategories'"/>
</form>

</body>
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/jsp/categoryList_blank.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
onload=initAd;
</script>
<h2>菜品分类</h2>
<input type = "button" value = "添加菜品分类" onclick="window.location.href='/order/addCategory'">
<input type = "button" value = "添加菜品分类" onclick="window.location.href='/addCategory'">
&nbsp;|&nbsp;
<input type = "button" value = "返回主菜单" onclick="window.location.href='/order/showMenus'">
<input type = "button" value = "返回主菜单" onclick="window.location.href='/showMenus'">
<%
if(errMsg != null && !errMsg.equalsIgnoreCase("")){
out.println("<div id='sponsorAdDiv'><br><font color=red>" + errMsg + "</font></div>");
Expand All @@ -71,8 +71,8 @@
<td align="center">${category.cid}</td>
<td>${category.cname}</td>
<td>
<input type = "button" value = "删除" onclick="javascript:if(confirm('确认删除${category.cname}?'))window.location.href='/order/deleteCategory/${category.cid}'">
<input type = "button" value = "更新" onclick="window.location.href='/order/editCategory/${category.cid}'">
<input type = "button" value = "删除" onclick="javascript:if(confirm('确认删除${category.cname}?'))window.location.href='/deleteCategory/${category.cid}'">
<input type = "button" value = "更新" onclick="window.location.href='/editCategory/${category.cid}'">
</td>
</tr>
</c:forEach>
Expand Down
16 changes: 8 additions & 8 deletions src/main/webapp/jsp/common/leftTree.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

<div class="sidebar-shortcuts" id="sidebar-shortcuts">
<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
<button class="btn btn-success" onclick="window.location.href='/order/showMenus'">
<button class="btn btn-success" onclick="window.location.href='/showMenus'">
<i class="icon-signal"></i>
</button>

<button class="btn btn-info" onclick="window.location.href='/order/addMenu'">
<button class="btn btn-info" onclick="window.location.href='/addMenu'">
<i class="icon-pencil"></i>
</button>

<button class="btn btn-warning" onclick="window.location.href='/order/showCategories'">
<button class="btn btn-warning" onclick="window.location.href='/showCategories'">
<i class="icon-group"></i>
</button>

<button class="btn btn-danger" onclick="window.location.href='/order/showMenus'">
<button class="btn btn-danger" onclick="window.location.href='/showMenus'">
<i class="icon-cogs"></i>
</button>
</div>
Expand All @@ -41,7 +41,7 @@
<!-- #sidebar-shortcuts -->
<ul class="nav nav-list">
<li <%if ("menuList".equalsIgnoreCase(_currentMenu)) {%> class='active' <%}%>>
<a href="/order/showMenus">
<a href="/showMenus">
<i class="icon-dashboard"></i>
<span class="menu-text"> 主菜单</span>
</a>
Expand All @@ -55,17 +55,17 @@

<ul class="submenu">
<li <%if ("addMenu".equalsIgnoreCase(_currentMenu)) {%> class='active' <%}%>>
<a href="/order/addMenu">
<a href="/addMenu">
<i class="icon-double-angle-right"></i>添加菜品
</a>
</li>
<li <%if ("cateList".equalsIgnoreCase(_currentMenu)) {%> class='active' <%}%>>
<a href="/order/showCategories">
<a href="/showCategories">
<i class="icon-double-angle-right"></i>查看菜品分类
</a>
</li>
<li>
<a href="">
<a href="/addCategory">
<i class="icon-double-angle-right"></i>添加菜品分类
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/jsp/menuAdd.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<div class="page-header">
</div>
<div class="col-xs-12">
<form class="form-horizontal" role="form" action="/order/saveMenu" method = "post">
<form class="form-horizontal" role="form" action="/saveMenu" method = "post">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 菜品名称 </label>

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/jsp/menuAdd_blank.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<body>
<h2>添加菜品</h2>
<form action="/order/saveMenu" method = "post">
<form action="/saveMenu" method = "post">
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>菜品名称</th>
Expand Down Expand Up @@ -50,7 +50,7 @@
<br>
<input type = "submit" value = "添加"/>
&nbsp;
<input type = "button" value = "取消" onclick="window.location.href='/order/showMenus'"/>
<input type = "button" value = "取消" onclick="window.location.href='/showMenus'"/>
</form>

</body>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/jsp/menuEdit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<body>
<h2>编辑菜品详情</h2>

<form action="/order/saveMenu" method = "post">
<form action="/saveMenu" method = "post">
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>菜品ID</th>
Expand Down Expand Up @@ -58,7 +58,7 @@
<br>
<input type = "submit" value = "提交修改"/>
&nbsp;
<input type = "button" value = "取消" onclick="window.location.href='/order/showMenus'"/>
<input type = "button" value = "取消" onclick="window.location.href='/showMenus'"/>
</form>

</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/jsp/menuList.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<td align="center">${menu.price}</td>
<td>
<input type = "button" value = "删除" onclick="javascript:if(confirm('确认删除${menu.mname}'))window.location.href='/delete/${menu.mid}'">
<input type = "button" value = "更新" onclick="window.location.href='/order/editMenu/${menu.mid}'">
<input type = "button" value = "更新" onclick="window.location.href='/editMenu/${menu.mid}'">
</td>
</tr>
</c:forEach>
Expand Down
12 changes: 6 additions & 6 deletions src/main/webapp/jsp/menuList_blank.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//如果ckUseCookie = on 并且当前的 currentCid 为空 则尝试提交相应的请求
if(ckUseCookie != null && ckUseCookie.getValue().equalsIgnoreCase("on") && currentCid == null){
%>
<jsp:forward page="/order/showMenus">
<jsp:forward page="/showMenus">
<jsp:param name="useCookie" value="<%=ckUseCookie.getValue()%>"></jsp:param>
<jsp:param name="cid" value="<%=ckCid.getValue()%>"></jsp:param>
</jsp:forward>
Expand All @@ -41,7 +41,7 @@

<body>
<h2>当前菜单</h2>
<form action = "/order/showMenus" method = "post">
<form action = "/showMenus" method = "post">
<b>查询:</b>
<select name="cid">
<option value="all"
Expand All @@ -66,9 +66,9 @@
</select>
<input type = "submit", value = "提交查询"/>
&nbsp;|&nbsp;
<input type = "button" value = "添加菜品" onclick="window.location.href='/order/addMenu'">
<input type = "button" value = "添加菜品" onclick="window.location.href='/addMenu'">
&nbsp;|&nbsp;
<input type = "button" value = "管理分类" onclick="window.location.href='/order/showCategories'">
<input type = "button" value = "管理分类" onclick="window.location.href='/showCategories'">
&nbsp;|&nbsp;
<input type = "checkbox" name = "useCookie"
<%
Expand Down Expand Up @@ -101,8 +101,8 @@
</td>
<td align="center">${menu.price}</td>
<td>
<input type = "button" value = "删除" onclick="javascript:if(confirm('确认删除${menu.mname}'))window.location.href='/order/delete/${menu.mid}'">
<input type = "button" value = "更新" onclick="window.location.href='/order/editMenu/${menu.mid}'">
<input type = "button" value = "删除" onclick="javascript:if(confirm('确认删除${menu.mname}'))window.location.href='/delete/${menu.mid}'">
<input type = "button" value = "更新" onclick="window.location.href='/editMenu/${menu.mid}'">
</td>
</tr>
</c:forEach>
Expand Down

0 comments on commit 7751973

Please sign in to comment.