-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmy.jsp
More file actions
275 lines (265 loc) · 11.3 KB
/
Copy pathmy.jsp
File metadata and controls
275 lines (265 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="t.o.bean.foodBean" %>
<%@page import="t.o.bean.DBfood" %>
<%@page import="t.o.bean.compositionBean" %>
<%@page import="t.o.bean.DBcomposition"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>绿丰花园时尚餐厅</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<link rel="stylesheet" type="text/css" href="css/all.css">
<link rel="stylesheet" type="text/css" href="css/my.css">
<script type="text/javascript">
function chechload(){
if("<%=session.getAttribute("userName") %>"!="null"){
document.getElementById("afterload").style.display = "block";
document.getElementById("userload").style.display = "none";
}
if("<%=session.getAttribute("carsize") %>"!="null"){
document.getElementById("carsize").firstChild.nodeValue = "<%=session.getAttribute("carsize") %>";
}
}
function oload(){
var name = document.getElementById("name").value;
var pass = document.getElementById("pass").value;
var validate = document.getElementById("validate").value;
if(name==""||pass==""){
alert("用户名,密码不能为空!!!");
}
else if(validate==""){
alert("验证码不能为空!!!");
}
else{
showHint();
}
}
function outload(){
window.location.href("userload?outload=1");
//document.getElementById("afterload").style.display = "none";
//document.getElementById("userload").style.display = "block";
}
function change(){
document.validate.src = "validate.jsp";
}
function show(object){
alert(object);
}
///////////////////////////////
var xmlHttp;
function showHint() {
var str = document.getElementById("validate").value;
if (str.length == 0) {
//innerHTML id内的HTML代码
document.getElementById("txtHint").innerHTML = "";
return false;
}
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("您的浏览器不支持AJAX!");
return false;
}
var url = "adminvalidate?q=" + str;
//发送一个请求后,客户端无法确定什么时候会完成这个请求,所以需要用事件机制来捕获请求的状态,XMLHttpRequest对象提供了onreadyStateChange事件实现这一功能。这类似于回调函数的做法。
//onreadyStateChange事件可指定一个事件处理函数来处理XMLHttpRequest对象的执行结果,
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
function stateChanged() {
if (xmlHttp.readyState == 4) {
if(xmlHttp.responseText=="错误"){
alert("验证码错误");
document.validate.src = "admin/validate.jsp";
document.getElementById("pass").value = "";
document.getElementById("validate").value = "";
}
if(xmlHttp.responseText=="正确"){
document.form1.action = "userload";
document.form1.submit();
}
//document.getElementById("txtHint").innerHTML = xmlHttp.responseText;
}
}
function GetXmlHttpObject() {
var xmlHttp = null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function addcar(object){
//window.location.href("shoppingcar?food_no=" + object.id);
window.location.href = "shoppingcar?food_no=" + object.id;
}
function lookcar(){
window.location.href = "shopingcar.jsp"
}
function lookorder(){
window.open("ordershow");
}
function changemessage(){
window.open("changemessage");
}
function goo(){
var str = document.getElementById("go").value;
window.location.href("foodlist?foodtype=nosh&ToPage="+str);
}
function searchfood(){
var foodsearch = document.form2.foodsearch.value;
if(foodsearch==""){
alert("搜索信息不能为空!!!");
}
else{
document.form2.submit();
}
}
</script>
<body onload="chechload();">
<center>
<div id="loginbg">
<div id="login" align="left">
<div id="menu">
<ul>
<li><a href="index.jsp">首页</a></li>
<li><a href="foodlist?foodtype=my">招牌</a></li>
<li><a href="foodlist?foodtype=china">中餐</a></li>
<li><a href="foodlist?foodtype=abroad">西餐</a></li>
<li><a href="foodlist?foodtype=cake">糕点</a></li>
<li><a href="foodlist?foodtype=nosh">小吃</a></li>
<li><a href="foodlist?foodtype=drink">饮品</a></li>
</ul>
</div>
</div>
</div>
<div id="content">
<div id="left" >
<div id="userload" align="center" style="font-size: 13px;">
<form name="form1" action="" method="post">
<table width="95%">
<tr><td colspan="2"><font size="2"><span class="STYLE1">用户登录</span></font></td>
</tr>
<tr height="15"><td width="40" align="right"><font size="2">用户名</font></td><td align="left"><font size="2"><INPUT style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" maxLength="30" size="13" id="name" name="name"></font> <a href="newuser.jsp" target="_blank">马上注册</a></td></tr>
<tr height="15"><td align="right"><font size="2">密 码</font></td><td align="left"><font size="2"><INPUT style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" type="password" maxLength="30" size="13" id="pass" name="pass"></font> <a href="getbackpwd.jsp" target="_blank">忘记密码</a></td></tr>
<tr height="15"><td align="right"><font size="2">验证码</font></td><td align="left"><font size="2"><INPUT style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" maxLength="30" size="4" id="validate" name="validate"><img src="admin/validate.jsp" name="validate"/><a href="javascript:change();"> 看不清楚?</a></font></td></tr>
<tr><td colspan="2" align="center"><font size="2"><input type="button" width="15" value="登录" onclick="oload();"></font></td></tr>
</table>
</form>
</div>
<div id="afterload" align="center" >
<table width="95%" >
<tr><td colspan="2" ><span class="STYLE1">登录成功</span></td></tr>
<tr height="50"><td width="28%"><img src="<%=basePath %>/images/userimg/<%=session.getAttribute("userimg") %>.gif" width="50" height="50"/></td><td align="center">欢迎进入点餐系统!<br>尊敬的<label id="carize" style="color:highlight; font-size: 14px;"><%=session.getAttribute("nackname") %></label>用户,您好!</td></tr>
<tr><td colspan="2" align="center"><input type="button" value="查看购物车" onclick="lookcar();">购物车中有<label id="carsize" style="color: red;font-size: 18px;">0</label>件</td></tr>
<tr><td colspan="2" align="center"><input type="button" value="查看订单" onclick="lookorder();" /><input type="button" value="修改资料" onclick="changemessage();" />
<input type="button" value="注销" onclick="outload();" /></td></tr>
</table>
</div>
<div id="hotfood">
<table width="95%">
<tr><td><span class="STYLE1">最新推出</span></td><td align="right"><a href="allfood" target="_blank">more</a></td></tr>
<%! int size = 0;String sql = null;foodBean foodbean;compositionBean combean; %>
<%
sql = "select * from t_o_Food order by o_foodId desc limit 5";
ArrayList<foodBean> hotfoodList = new ArrayList<foodBean>();
hotfoodList = DBfood.getfm(sql);
size = hotfoodList.size();
for(int i=0;i<size;i++){
foodbean = hotfoodList.get(i);
%>
<tr height="96">
<td width="100"><a href="foodmessage?no=<%=foodbean.getFood_no() %>" target="_blank"><img src="images/foodimg/<%=foodbean.getFood_no() %>.jpg" width="100" height="80"/></a></td>
<td><a href="foodmessage?no=<%=foodbean.getFood_no() %>" target="_blank"><%=foodbean.getFood_name() %></a><br/>价格:<%=foodbean.getFood_price() %>元<br/>
<input type="button" id="<%=foodbean.getFood_no() %>" value="加入购物车" onclick="addcar(this);">
</td>
</tr>
<%
}
%>
</table>
</div>
</div>
<div id="center" align="left">
<div id="health" align="center">
<table width="95%" width="95%">
<tr><td width="30%"><img src="images/tishi.jpg" height="140" /></td><td>
<table width="100%" height="100%"><tr>
<%
sql = "select * from t_o_Com where o_cType = '健康'";
ArrayList<compositionBean> comList = new ArrayList<compositionBean>();
comList = DBcomposition.getcm(sql);
size = comList.size();
int row = 0;
if(size<=10){
for(int i=size-1;i>=0;i--){
row++;
combean = comList.get(i);
%>
<td>·</td><td><a href="composition?news=<%=combean.getC_no() %>" target="_blank"><%=combean.getC_title() %></a></td>
<%if(row%2==0){out.print("</tr><tr>");}}}
else{
for(int i=size-1;i>=size-10;i--){
row++;
combean = comList.get(i);
%>
<td>·</td><td><a href="composition?news=<%=combean.getC_no() %>" target="_blank"><%=combean.getC_title() %></a></td>
<%if(row%2==0){out.print("</tr><tr>");}}
} %>
</tr></table>
</td></tr>
</table>
</div>
<div id="showfood" align="center">
<table width="95%" height="453" >
<tr><td align="left" height="33"><span class="STYLE1">招牌菜</span><br></td>
<td align="right">
<form action="allfood" target="_self" name="form2">菜色搜索:<input type="text" name="foodsearch"/>
<input type="button" value="搜索" onclick="searchfood();"/></form></td></tr>
<tr><td valign="top" colspan="2"><table style="margin-top: 0px;" align="center"><tr>
<%!int sizea = 0; %>
<%
response.setCharacterEncoding("utf-8");
ArrayList<foodBean> foodList = (ArrayList<foodBean>)session.getAttribute("foodList");
sizea = foodList.size();
foodBean foodbean;
for(int i=0;i<sizea;i++){
foodbean = foodList.get(i);
%>
<td height="80" width="100"><a href="foodmessage?no=<%=foodbean.getFood_no() %>" target="_self"><img src="images/foodimg/<%=foodbean.getFood_no() %>.jpg" width="90" height="68"/></a></td>
<td width="140"><a href="foodmessage?no=<%=foodbean.getFood_no() %>" target="_self"><%=foodbean.getFood_name() %></a><br/>价格:<%=foodbean.getFood_price() %>元<br/>
<input type="button" id="<%=foodbean.getFood_no() %>" value="加入购物车" onclick="addcar(this);">
</td>
<%if(i%3==2){out.print("</tr><tr>");}
}
%>
</tr></table></td></tr>
</table>
<table style="margin-top: 0px;" width="95%" ><tr><td align="center"><%=session.getAttribute("str") %></td></tr></table>
</div>
</div>
</div>
<div id="dowmbg">
<div id="dowm">
</div>
</div>
</center>
</body>
</html>