package com.cn.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cn.service.LoginService;
import com.cn.service.ssmService;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("/")
public class ssmController {
@Autowired
private ssmService ssmService;
@Autowired
private LoginService loginService;
@RequestMapping(value ="/loginText")
public String login(){
return "login";
}
@RequestMapping(value ="/index")
public String index(){
return "index";
}
@RequestMapping(value ="/login",method = RequestMethod.POST)
@ResponseBody
public String index(String wdName,String password,Model model){
System.out.println("--------------开始");
HashMap<String,Object> map = new HashMap<>();
map.put("wdName", wdName);
map.put("password", password);
String data = loginService.LoginSelect(map);
System.out.println(data);
System.out.println("--------------结束");
if(data.equalsIgnoreCase("index")){
//返回值给前端
model.addAttribute("Result", "success");
return "";
}else{
return "login";
}
}
@RequestMapping(value = "/Add",method = RequestMethod.POST)
@ResponseBody
public String UserAdd( @RequestBody String UserData,
HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, HttpSession httpSession){
String Data = UserData;
String data = ssmService.insertUerService(Data);
return data;
}
@RequestMapping(value = "/selectUser",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
@ResponseBody
public String SelectUser(@RequestBody Map<String,Object> maps,HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, HttpSession httpSession){
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("pageNo",maps.get("pageNo"));
map.put("pageSize", maps.get("pageSize"));//获取查询的起始页、例如 start 1 (pageSize*(pageNo-1)) end 10 (pageSize*pageNo)--》(StartPage),
int No = Integer.parseInt(maps.get("pageNo").toString());
int Size = Integer.parseInt(maps.get("pageSize").toString());
if(No <= 1 ){
map.put("StartPage",1);
map.put("EndPage", No*Size);
}else{
map.put("StartPage",(Size*( No-1)+1));
map.put("EndPage", No*Size);
}
String data = ssmService.selectUser(map);
return data;
}
@RequestMapping(value = "/pageCount",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
@ResponseBody
public String PageCont(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, HttpSession httpSession){
String data = ssmService.pagecont();
JSONObject JSON = new JSONObject();
int count = Integer.parseInt(data);
JSON.put("success", count);
return JSON.toString();
}
@RequestMapping(value = "/UpdateUser",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
@ResponseBody
public String UpdataUser(@RequestBody Map<String,Object> map,HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, HttpSession httpSession){
String data = ssmService.UpssmBean(map);
JSONObject JSONS = new JSONObject();
if("success".equals(data)){
JSONS.put("UserData", data);
}else{
JSONS.put("UserData", data);
}
return JSONS.toString();
}
@RequestMapping(value = "/DeleteId",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
@ResponseBody
public String DeleteUser(@RequestBody Map<String,Object> map,HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, HttpSession httpSession){
String data = ssmService.DeletUser(Integer.parseInt(map.get("UserId").toString()));
JSONObject JSONS = new JSONObject();
if("success".equals(data)){
JSONS.put("UserData", data);
}else{
JSONS.put("UserData", data);
}
return JSONS.toString();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Spring,Springmvc,Mybatis,AngularJs,Bootstrop
共85个文件
xml:13个
java:10个
js:10个
需积分: 10 7 下载量 188 浏览量
2017-01-06
10:47:51
上传
评论
收藏 1.3MB RAR 举报
温馨提示
Spring,Springmvc,Mybatis,AngularJs,Bootstrop框架完整的CURD以及Login页面。 开发环境,jdk1.8,maven.3.3,tomcat8.0,Mybatis.3.2,web.xml,3.1,Spring4.0
资源推荐
资源详情
资源评论
收起资源包目录
SpringSMy.rar (85个子文件)
SpringSMy
.project 1KB
src
logs
ssm.log 0B
test
java
main
webapp
WEB-INF
jsp
index.jsp 2KB
LongUserPage.jsp 2KB
html
index.html 4KB
login.html 1KB
web.xml 3KB
errorpage
500.jsp 399B
405.jsp 399B
404.jsp 401B
StaticResources
img
cj011.php.jpg 425KB
cj01.php.jpg 186KB
cj012.php.jpg 289KB
js
login.js 2KB
LongUserPage.js 2KB
indexAngualerjs.js 7KB
index.js 226B
bootstop
jquery-1.11.1.js 287KB
bootstrap.min.css 111KB
bootstrap.min.js 34KB
css
LongUserPage.css 104B
IndexCss.css 229B
login.css 1KB
resources
jdbc.properties 273B
config
spring-mybatis.xml 5KB
spring-mvc.xml 3KB
log4j.properties 1023B
java
com
cn
service
LoginService.java 149B
ssmService.java 418B
sierviceImp
ToolUTF.java 68B
ssmServiceImp.java 2KB
LoginServiceImp.java 1KB
pojo
ssmBean.java 502B
LoginBean.java 458B
controller
ssmController.java 4KB
mapper
loginDao.xml 1KB
ssmDao.xml 2KB
dao
loginDao.java 188B
ssmDao.java 488B
target
m2e-wtp
web-resources
META-INF
MANIFEST.MF 105B
maven
SpringSMy
SpringSMy
pom.properties 217B
pom.xml 8KB
classes
com
cn
service
ssmService.class 575B
LoginService.class 284B
sierviceImp
ToolUTF.class 300B
ssmServiceImp.class 3KB
LoginServiceImp.class 2KB
pojo
LoginBean.class 730B
ssmBean.class 910B
controller
ssmController.class 5KB
mapper
loginDao.xml 1KB
ssmDao.xml 2KB
dao
loginDao.class 308B
ssmDao.class 512B
jdbc.properties 273B
config
spring-mybatis.xml 5KB
spring-mvc.xml 3KB
log4j.properties 1023B
test-classes
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 346B
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.ws.service.policy.prefs 87B
org.eclipse.jdt.core.prefs 736B
org.eclipse.wst.validation.prefs 50B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.prefs.xml 321B
org.eclipse.core.resources.prefs 170B
org.eclipse.wst.common.component 668B
.jsdtscope 639B
dist
jquery-1.11.1.js 287KB
js
npm.js 484B
bootstrap.js 64KB
bootstrap.min.js 34KB
fonts
glyphicons-halflings-regular.ttf 40KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.svg 61KB
glyphicons-halflings-regular.woff 23KB
css
bootstrap-theme.css.map 41KB
bootstrap.min.css 111KB
bootstrap-theme.min.css 19KB
bootstrap-theme.css 21KB
bootstrap.css.map 358KB
bootstrap.css 134KB
pom.xml 8KB
.classpath 1KB
共 85 条
- 1
资源评论
a519915774
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功