package com.chatRobot.controller;
import javax.servlet.http.HttpServletRequest;
import com.chatRobot.model.User;
import com.chatRobot.service.IUserService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource
private IUserService userService;
@RequestMapping("/showUser.do")
public void selectUser(HttpServletRequest request, HttpServletResponse response) throws IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
long userId = Long.parseLong(request.getParameter("id"));
User user = this.userService.selectUser(userId);
ObjectMapper mapper = new ObjectMapper();
response.getWriter().write(mapper.writeValueAsString(user));
response.getWriter().close();
}
@RequestMapping("/addUser.do")
public void addUser(HttpServletRequest request, HttpServletResponse response,User user) throws IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
user.setStatus(0);
user.setRegTime(new Date());
user.setRegIp("127.0.0.3");
userService.addUser(user);
System.out.println(user.getUsername() + "OK!");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
使用idea2018搭建SSM框架 (113个子文件)
UserController.class 3KB
UserController.class 3KB
User.class 2KB
User.class 2KB
UserServiceImpl.class 1KB
UserServiceImpl.class 1KB
IUserDaoTest.class 963B
IUserDaoTest.class 963B
IUserService.class 297B
IUserService.class 297B
IUserDao.class 285B
IUserDao.class 285B
bootstrap.css 143KB
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
bootstrap-theme.css 26KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
bootstrap-theme.min.css 23KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 20KB
regist.html 4KB
regist.html 4KB
index.html 703B
index.html 703B
success.html 150B
success.html 150B
javaee-api-7.0.jar 1.84MB
mybatis-3.4.1.jar 1.51MB
jackson-databind-2.8.7.jar 1.18MB
spring-context-4.3.5.RELEASE.jar 1.08MB
spring-core-4.3.5.RELEASE.jar 1.06MB
mysql-connector-java-5.1.41.jar 970KB
spring-webmvc-4.3.5.RELEASE.jar 893KB
spring-web-4.3.5.RELEASE.jar 797KB
spring-beans-4.3.5.RELEASE.jar 744KB
mchange-commons-java-0.2.11.jar 592KB
spring-test-4.3.5.RELEASE.jar 585KB
javax.mail-1.5.0.jar 510KB
c3p0-0.9.5.2.jar 486KB
logback-core-1.2.2.jar 462KB
spring-jdbc-4.3.5.RELEASE.jar 417KB
spring-aop-4.3.5.RELEASE.jar 371KB
junit-4.12.jar 308KB
logback-classic-1.2.2.jar 284KB
jackson-core-2.8.7.jar 276KB
spring-tx-4.3.5.RELEASE.jar 261KB
spring-expression-4.3.5.RELEASE.jar 257KB
activation-1.1.jar 62KB
commons-logging-1.2.jar 60KB
jackson-annotations-2.8.0.jar 54KB
mybatis-spring-1.3.1.jar 52KB
hamcrest-core-1.3.jar 44KB
slf4j-api-1.7.25.jar 40KB
UserController.java 2KB
User.java 1KB
IUserDaoTest.java 1KB
UserServiceImpl.java 762B
IUserDaoTest.java 713B
IUserService.java 275B
IUserDao.java 257B
bootstrap.js 68KB
bootstrap.js 68KB
bootstrap.min.js 36KB
bootstrap.min.js 36KB
npm.js 484B
npm.js 484B
bootstrap.min.css.map 529KB
bootstrap.min.css.map 529KB
bootstrap.css.map 380KB
bootstrap.css.map 380KB
bootstrap-theme.css.map 47KB
bootstrap-theme.css.map 47KB
bootstrap-theme.min.css.map 25KB
bootstrap-theme.min.css.map 25KB
MANIFEST.MF 99B
jdbc.properties 413B
jdbc.properties 413B
jdbc.properties 413B
ChatRobot.sql 732B
ChatRobot.sql 0B
ChatRobot.sql 0B
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.ttf 44KB
ChatRobot.war 13.41MB
glyphicons-halflings-regular.woff 23KB
glyphicons-halflings-regular.woff 23KB
glyphicons-halflings-regular.woff2 18KB
glyphicons-halflings-regular.woff2 18KB
workspace.xml 52KB
uiDesigner.xml 9KB
pom.xml 4KB
spring-mybatis.xml 3KB
spring-mybatis.xml 3KB
spring-mybatis.xml 3KB
web.xml 2KB
web.xml 2KB
共 113 条
- 1
- 2
资源评论
qq_175****220
- 粉丝: 390
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功