Skip to content

Commit

Permalink
测试新分支
Browse files Browse the repository at this point in the history
  • Loading branch information
mewhz committed Dec 30, 2021
1 parent 95855a2 commit 893cd89
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/main/java/com/mewhz/paste/controller/Heap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mewhz.paste.controller;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.druid.support.json.JSONUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Heap {

@ResponseBody
@RequestMapping("/head")
public JSONObject head(){
JSONObject json = JSONUtil.createObj();

json.append("name", "小明").append("age", "20");

return json;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class LoginController {
@RequestMapping("/login")
public String login(@RequestParam String user, @RequestParam String pass){
System.out.println(user + " " + pass);
return user + " " + pass;
if (!"admin".equals(user) || !"admin".equals(pass)){
return "ERROR";
}
return "success";
}
}
13 changes: 13 additions & 0 deletions src/main/resources/static/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/head.js"></script>
</head>
<body>
<h1></h1>

</body>
</html>
8 changes: 8 additions & 0 deletions src/main/resources/static/js/head.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$(document).ready(()=>{
$.getJSON("/head", (result)=>{
console.log(result);
$.each(result, (i, temp)=>{
$("h1").append(temp + " ");
});
})
});

0 comments on commit 893cd89

Please sign in to comment.