Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
onionZunyi
beauty_ssm
提交
f878049b
B
beauty_ssm
项目概览
onionZunyi
/
beauty_ssm
与 Fork 源项目一致
Fork自
爱吃血肠 / beauty_ssm
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beauty_ssm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f878049b
编写于
3月 04, 2018
作者:
爱吃血肠
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用户登录使用异步提交方式 解决ajax返回数据乱码问题
上级
85b4c319
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
145 deletion
+19
-145
src/main/java/com/yingjun/ssm/web/UserController.java
src/main/java/com/yingjun/ssm/web/UserController.java
+4
-3
src/main/webapp/WEB-INF/jsp/common/head.jsp
src/main/webapp/WEB-INF/jsp/common/head.jsp
+0
-6
src/main/webapp/WEB-INF/jsp/common/tag.jsp
src/main/webapp/WEB-INF/jsp/common/tag.jsp
+0
-6
src/main/webapp/WEB-INF/jsp/goodslist.jsp
src/main/webapp/WEB-INF/jsp/goodslist.jsp
+0
-85
src/main/webapp/WEB-INF/jsp/user/userLogin.jsp
src/main/webapp/WEB-INF/jsp/user/userLogin.jsp
+15
-3
src/main/webapp/WEB-INF/jsp/userlist.jsp
src/main/webapp/WEB-INF/jsp/userlist.jsp
+0
-42
未找到文件。
src/main/java/com/yingjun/ssm/web/UserController.java
浏览文件 @
f878049b
...
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Controller;
...
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Controller;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
/**
...
@@ -25,10 +25,11 @@ public class UserController {
...
@@ -25,10 +25,11 @@ public class UserController {
* 用户登录
* 用户登录
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/userLogin"
)
@ResponseBody
@RequestMapping
(
value
=
"/userLogin"
,
produces
=
"text/html;charset=UTF-8"
)
public
String
userLogin
(
@ModelAttribute
User
user
)
{
public
String
userLogin
(
@ModelAttribute
User
user
)
{
LOG
.
info
(
"表单提交的用户信息:"
+
user
.
toString
());
LOG
.
info
(
"表单提交的用户信息:"
+
user
.
toString
());
return
"
/user/userLogin
"
;
return
"
登录成功
"
;
}
}
/**
/**
...
...
src/main/webapp/WEB-INF/jsp/common/head.jsp
已删除
100644 → 0
浏览文件 @
85b4c319
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
href=
"http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.css"
rel=
"stylesheet"
>
<script
src=
"http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"
></script>
<script
src=
"http://apps.bdimg.com/libs/respond.js/1.4.2/respond.js"
></script>
<script
src=
"http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"
></script>
<script
src=
"http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"
></script>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/common/tag.jsp
已删除
100644 → 0
浏览文件 @
85b4c319
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"fmt"
uri=
"http://java.sun.com/jsp/jstl/fmt"
%>
<%
request
.
setCharacterEncoding
(
"utf-8"
);
String
path
=
request
.
getContextPath
();
%>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/goodslist.jsp
已删除
100644 → 0
浏览文件 @
85b4c319
<%@ page
contentType=
"text/html;charset=UTF-8"
language=
"java"
%>
<%@include
file=
"common/tag.jsp"
%>
<!DOCTYPE html>
<html>
<head>
<title>
商品列表
</title>
<%@include
file=
"common/head.jsp"
%>
</head>
<body>
<div
class=
"container"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading text-center"
>
<h2>
商品列表
</h2>
</div>
<div
class=
"panel-body"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<td>
商品ID
</td>
<td>
商品名称
</td>
<td>
商品价格
</td>
<td>
商品状态
</td>
<td>
商品数量
</td>
<td>
操作
</td>
</tr>
</thead>
<tbody>
<c:forEach
var=
"goods"
items=
"
${
goodslist
}
"
>
<tr>
<td>
${goods.goodsId}
</td>
<td>
${goods.title}
</td>
<td>
${goods.price}
</td>
<td><c:if
test=
"
${
goods
.
state
==
0
}
"
>
已下架
</c:if>
<c:if
test=
"
${
goods
.
state
==
1
}
"
>
销售中
</c:if></td>
<td>
${goods.number}
</td>
<td><button
class=
"btn btn-info"
id=
"goodsBuy"
onclick=
"handler.goodsBuy(${goods.goodsId});"
>
购买
</button></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<%--登录弹出层 输入电话--%>
<div
id=
"loginModal"
class=
"modal fade"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h3
class=
"modal-title text-center"
>
<span
class=
"glyphicon glyphicon-phone"
>
</span>
用户电话
</h3>
</div>
<div
class=
"modal-body"
>
<div
class=
"row"
>
<div
class=
"col-xs-8 col-xs-offset-2"
>
<input
type=
"text"
name=
"userPhone"
id=
"userPhone"
placeholder=
"填写手机号"
class=
"form-control"
>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
<%--验证信息--%>
<span
id=
"userPhoneMessage"
class=
"glyphicon"
>
</span>
<button
type=
"button"
id=
"loginBtn"
class=
"btn btn-success"
>
<span
class=
"glyphicon glyphicon-phone"
></span>
提交
</button>
</div>
</div>
</div>
</div>
</body>
<script
src=
"http://apps.bdimg.com/libs/jquery.cookie/1.4.1/jquery.cookie.js"
></script>
<script
src=
"
<%=
path
%>
/resource/script/handler.js"
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
>
$
(
function
()
{
//初始化业务逻辑script
handler
.
goods
.
init
({});
})
</script>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/user/userLogin.jsp
浏览文件 @
f878049b
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<div
class=
"header"
>
<div
class=
"header"
>
<h3>
用户登录
</h3>
<h3>
用户登录
</h3>
</div>
</div>
<form
id=
"userLogin"
action=
"
/user/userLogin
"
method=
"post"
>
<form
id=
"userLogin"
action=
""
method=
"post"
>
<div
class=
"detail"
>
<div
class=
"detail"
>
<ul>
<ul>
<li>
<li>
...
@@ -83,9 +83,21 @@
...
@@ -83,9 +83,21 @@
</footer>
</footer>
</body>
</body>
<script>
<script>
//用户登录
//用户登录
异步提交表单
$
(
'
#loginBtn
'
).
bind
(
"
click
"
,
function
(){
$
(
'
#loginBtn
'
).
bind
(
"
click
"
,
function
(){
$
(
'
#userLogin
'
).
submit
();
//$('#userLogin').submit();
var
uploadFormData
=
new
FormData
(
$
(
'
#userLogin
'
)[
0
]);
$
.
ajax
({
type
:
'
POST
'
,
data
:
uploadFormData
,
url
:
'
/user/userLogin
'
,
processData
:
false
,
contentType
:
false
,
async
:
false
,
success
:
function
(
data
)
{
console
.
log
(
data
);
}
});
});
});
</script>
</script>
</html>
</html>
src/main/webapp/WEB-INF/jsp/userlist.jsp
已删除
100644 → 0
浏览文件 @
85b4c319
<%@ page
contentType=
"text/html;charset=UTF-8"
language=
"java"
%>
<%@include
file=
"common/tag.jsp"
%>
<!DOCTYPE html>
<html>
<head>
<title>
用户列表
</title>
<%@include
file=
"common/head.jsp"
%>
</head>
<body>
<div
class=
"container"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading text-center"
>
<h2>
用户列表
</h2>
</div>
<div
class=
"panel-body"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<td>
用户ID
</td>
<td>
用户名
</td>
<td>
手机号
</td>
<td>
积分
</td>
</tr>
</thead>
<tbody>
<c:forEach
var=
"user"
items=
"
${
userlist
}
"
>
<tr>
<td>
${user.userId}
</td>
<td>
${user.userName}
</td>
<td>
${user.userPhone}
</td>
<td>
${user.score}
</td>
<td><fmt:formatDate
value=
"
${
user
.
createTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录