IDEA简单实现登录注册页面

application.yml

spring:
 datasource:
  username: root
  password: 123456
  url: jdbc:mysql://localhost:3306/bd1906?serverTimezone=GMT%2B8
  driver-class-name: com.mysql.cj.jdbc.Driver
server:
  port: 8080

Controller层

@Controller
public class loginController {

  @Autowired
  private JdbcTemplate jdbcTemplate;

  @RequestMapping("/index")
  public String border(){
    return "/index.html";
  }

  @RequestMapping("/login")
  public String getUserFront(){
    return "/login.html";
  }

  @RequestMapping(value = "/log",method = RequestMethod.POST)
  @ResponseBody
  public String log(String name,String psd){
    String sql = "select * from user where username = '"+ name +"' and password = '"+psd+"'";
    List> list = jdbcTemplate.queryForList(sql);
    if(list.size() == 0){
      return "0";
    }
    else{
      return "1";
    }
  }
}

登录页面




  
  
  login
  


智能互联装备协同管理平台

到此这篇关于IDEA简单实现登录注册页面的文章就介绍到这了,更多相关idea实现登录页面内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

你可能感兴趣的:(IDEA简单实现登录注册页面)