idea登录页面ajax验证,IDEA如何实现登录注册页面 IDEA实现登录注册页面代码示例...

2023-05-16

IDEA如何实现登录注册页面?本篇文章小编给大家分享一下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

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

cutter.png

user.png

lock.png

//刀盘旋转

var rotateVal = 0 // 旋转角度

var InterVal // 定时器

window.onload = function () {

// 网页加载完成后即运行rotate函数

rotate()

}

// 设置定时器

function rotate () {

InterVal = setInterval(function () {

var img = document.getElementById('img')

rotateVal += 1

// 设置旋转属性(顺时针)

img.style.transform = 'rotate(' + rotateVal + 'deg)'

// 设置旋转时的动画 匀速0.1s

img.style.transition = '0.1s linear'

}, 100)

}

//判断及请求

$(function () {

$("#btLogin").click(function () {

var name = $("#userName").val();

var psd = $("#userPsd").val();

console.log(name,psd);

if (name == "" || name == null){

alert("用户名不能为空!")

return;

}

if (psd == "" || psd == null){

alert("密码不能为空!")

return;

}

$.ajax({

type: "post",

url: "/log",

data: {name: name,psd: psd},

success:function(data){

if(data == "1"){

window.location.href="./index" rel="external nofollow" ;

}else{

alert("登录失败,账号密码不匹配!")

}

}

})

})

})

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

idea登录页面ajax验证,IDEA如何实现登录注册页面 IDEA实现登录注册页面代码示例... 的相关文章

随机推荐