4.28-团队项目-每日任务-前后端链接
1、数据库链接和简单进行用户注册的相关问题
2、完成情况
数据库已连接,用户注册问题解决完成个人信息相关的录入
package com.atguigu.crud.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import com.atguigu.crud.bean.User;
import com.atguigu.crud.service.UserService;
import javax.servlet.http.HttpSession;
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
UserService userService;
@GetMapping("/edit")
public String edit(String action) {
boolean xiu;
if (action != null) {
xiu = true;
} else
xiu = false;
return "forward:/WEB-INF/jsp/user/edit.jsp?isxiugai=" + xiu;
}
@PostMapping("/edit2")
public String doedit(User user, Model model, @SessionAttribute("user") User user1, HttpSession session) {
try {
userService.modify(user);
user1.setUser_type(user.getUser_type());
user1.setNick_name(user.getNick_name());
user1.setPhone(user.getPhone());
user1.setTrue_name(user.getTrue_name());
user1.setId_card(user.getId_card());
user1.setSex(user.getSex());
user1.setQq_code(user.getQq_code());
user1.setWechat_code(user.getWechat_code());
user1.setSignature(user.getSignature());
session.setAttribute("user", user1);
model.addAttribute("msg", "保存成功");
} catch (Exception e) {
model.addAttribute("msg", "保存失败");
}
return "forward:/WEB-INF/jsp/user/edit.jsp?isxiugai=" + true;
}
@GetMapping("/head.html")
public String head() {
return "user/head";
}
}
3、明日任务
完成社团信息以及进行用户信息分类