mirror of
https://github.com/ityouknow/spring-boot-examples.git
synced 2026-05-19 11:36:50 +08:00
add thymeleaf jpa demo
This commit is contained in:
@@ -13,6 +13,8 @@ Spring boot使用的各种示例,以最简单、最实用为标准
|
||||
- [spring-boot-mybaits-xml](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-xml):xml配置版本
|
||||
- [spring-boot-mybatis-mulidatasource](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-mulidatasource):springboot+mybatis多数据源最简解决方案
|
||||
- [spring-boot-mybatis-annotation-mulidatasource](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-annotation-mulidatasource):springboot+mybatis(注解版)多数据源最简解决方案
|
||||
- [spring-boot-thymeleaf](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf):简单 spring boot thymeleaf 脚手架
|
||||
- [spring-boot-jpa-thymeleaf-curd](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd):spring boot + jpa + thymeleaf 增删改查示例
|
||||
- [spring-boot-rabbitmq](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-rabbitmq):spring boot和rabbitmq各种消息应用案例
|
||||
- [spring-boot-scheduler](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-scheduler):spring boot和定时任务案例
|
||||
- [spring-boot-web](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-web):web开发综合使用案例
|
||||
@@ -21,8 +23,7 @@ Spring boot使用的各种示例,以最简单、最实用为标准
|
||||
- [spring-boot-multi-mongodb](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-multi-mongodb):spring boot和mongodb多数据源的使用
|
||||
- [spring-boot-package-war](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-package-war):spring-boot打包成war包示例
|
||||
- [spring-boot-shiro](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-shiro):springboot 整合shiro rbac示例
|
||||
- [spring-boot-thymeleaf](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf):简单 spring boot thymeleaf 脚手架
|
||||
- [spring-boot-jpa-thymeleaf-curd](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd):spring boot + jpa + thymeleaf 增删改查示例
|
||||
|
||||
- [Favorites-web](https://github.com/cloudfavorites/favorites-web):云收藏(springboot实战开源软件)
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ Spring Boot Examples, Use the simplest and most useful scene demo.
|
||||
- [spring-boot-mybaits-xml](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-xml):Spring Boot use mybatis xml
|
||||
- [spring-boot-mybatis-mulidatasource](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-mulidatasource):Spring Boot+mybatis+mulidatasource
|
||||
- [spring-boot-mybatis-annotation-mulidatasource](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-annotation-mulidatasource):Spring Boot+ mybatis annotation + mulidatasource
|
||||
- [spring-boot-thymeleaf](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf):simple spring boot thymeleaf demo
|
||||
spring-boot-thymeleaf):简单 spring boot thymeleaf 脚手架
|
||||
- [spring-boot-jpa-thymeleaf-curd](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd):spring boot + jpa + thymeleaf curd demo
|
||||
- [spring-boot-rabbitmq](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-rabbitmq): using AMQP and RabbitMQ
|
||||
- [spring-boot-scheduler](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-scheduler):Timed tasks developed using Spring Boot
|
||||
- [spring-boot-web](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-web):Web projects developed using Spring Boot
|
||||
@@ -22,7 +25,4 @@ Spring Boot Examples, Use the simplest and most useful scene demo.
|
||||
- [spring-boot-multi-mongodb](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-multi-mongodb):Spring Boot + multiMongodb
|
||||
- [spring-boot-package-war](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-package-war):Spring Boot package war
|
||||
- [spring-boot-shiro](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-shiro):spring boot shiro rbac demo
|
||||
- [spring-boot-thymeleaf](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf):simple spring boot thymeleaf demo
|
||||
spring-boot-thymeleaf):简单 spring boot thymeleaf 脚手架
|
||||
- [spring-boot-jpa-thymeleaf-curd](https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd):spring boot + jpa + thymeleaf curd demo
|
||||
- [Favorites-web](https://github.com/cloudfavorites/favorites-web):Open source projects developed using Spring Boot
|
||||
|
||||
@@ -41,7 +41,6 @@ public class UserController {
|
||||
return "redirect:/list";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public String toEdit(Model model,Long id) {
|
||||
User user=userService.findUserById(id);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.3.5.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring4:2.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:2.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ognl:ognl:3.0.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy:2.4.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.0.12.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.0.12.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.11.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.13.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-orm:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.43" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-devtools:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.6.RELEASE" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.neo.thymeleaf.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class User {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
@Column(nullable = false, unique = true)
|
||||
private String userName;
|
||||
@Column(nullable = false)
|
||||
private String password;
|
||||
@Column(nullable = false)
|
||||
private int age;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public User setId(long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public User setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public User setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public User setAge(int age) {
|
||||
this.age = age;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.neo.thymeleaf.repository;
|
||||
|
||||
import com.neo.thymeleaf.entity.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
|
||||
User findById(long id);
|
||||
|
||||
Long deleteById(Long id);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.neo.thymeleaf.service;
|
||||
|
||||
import com.neo.thymeleaf.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
public List<User> getUserList();
|
||||
|
||||
public User findUserById(long id);
|
||||
|
||||
public void save(User user);
|
||||
|
||||
public void edit(User user);
|
||||
|
||||
public void delete(long id);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.neo.thymeleaf.service.impl;
|
||||
|
||||
import com.neo.thymeleaf.entity.User;
|
||||
import com.neo.thymeleaf.repository.UserRepository;
|
||||
import com.neo.thymeleaf.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService{
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public List<User> getUserList() {
|
||||
return userRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User findUserById(long id) {
|
||||
return userRepository.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(User user) {
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(User user) {
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(long id) {
|
||||
userRepository.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.neo.thymeleaf.web;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Controller
|
||||
public class HelloController {
|
||||
|
||||
@RequestMapping("/hello")
|
||||
public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
|
||||
model.addAttribute("name", name);
|
||||
return "hello";
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.neo.thymeleaf.web;
|
||||
|
||||
import com.neo.thymeleaf.entity.User;
|
||||
import com.neo.thymeleaf.service.UserService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
UserService userService;
|
||||
|
||||
|
||||
@RequestMapping("/")
|
||||
public String index() {
|
||||
return "redirect:/list";
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(Model model) {
|
||||
List<User> users=userService.getUserList();
|
||||
model.addAttribute("users", users);
|
||||
return "user/list";
|
||||
}
|
||||
|
||||
@RequestMapping("/toAdd")
|
||||
public String toAdd() {
|
||||
return "user/userAdd";
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public String add(User user) {
|
||||
userService.save(user);
|
||||
return "redirect:/list";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public String toEdit(Model model,Long id) {
|
||||
User user=userService.findUserById(id);
|
||||
model.addAttribute("user", user);
|
||||
return "user/userEdit";
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
public String edit(User user) {
|
||||
userService.edit(user);
|
||||
return "redirect:/list";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public String delete(Long id) {
|
||||
userService.delete(id);
|
||||
return "redirect:/list";
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,43 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>userList</title>
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"></link>
|
||||
</head>
|
||||
<body class="container">
|
||||
<br/>
|
||||
<h1>用户列表</h1>
|
||||
<br/><br/>
|
||||
<div class="with:80%">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>User Name</th>
|
||||
<th>Password</th>
|
||||
<th>Age</th>
|
||||
<th>Edit</th>
|
||||
<th>Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="user : ${users}">
|
||||
<th scope="row" th:text="${user.id}">1</th>
|
||||
<td th:text="${user.userName}">neo</td>
|
||||
<td th:text="${user.password}">Otto</td>
|
||||
<td th:text="${user.age}">6</td>
|
||||
<td><a th:href="@{/toEdit(id=${user.id})}">edit</a></td>
|
||||
<td><a th:href="@{/delete(id=${user.id})}">delete</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2 control-label">
|
||||
<a href="/toAdd" th:href="@{/toAdd}" class="btn btn-info">add</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>user</title>
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"></link>
|
||||
</head>
|
||||
<body class="container">
|
||||
<br/>
|
||||
<h1>添加用户</h1>
|
||||
<br/><br/>
|
||||
<div class="with:80%">
|
||||
<form class="form-horizontal" th:action="@{/add}" method="post">
|
||||
<div class="form-group">
|
||||
<label for="userName" class="col-sm-2 control-label">userName</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="userName" id="userName" placeholder="userName"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="col-sm-2 control-label" >Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" name="password" id="password" placeholder="Password"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="age" class="col-sm-2 control-label">age</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="age" id="age" placeholder="age"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="submit" value="Submit" class="btn btn-info" />
|
||||
|
||||
<input type="reset" value="Reset" class="btn btn-info" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,44 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>user</title>
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"></link>
|
||||
</head>
|
||||
<body class="container">
|
||||
<br/>
|
||||
<h1>修改用户</h1>
|
||||
<br/><br/>
|
||||
<div class="with:80%">
|
||||
<form class="form-horizontal" th:action="@{/edit}" th:object="${user}" method="post">
|
||||
<input type="hidden" name="id" th:value="*{id}" />
|
||||
<div class="form-group">
|
||||
<label for="userName" class="col-sm-2 control-label">userName</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="userName" id="userName" th:value="*{userName}" placeholder="userName"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="col-sm-2 control-label" >Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" name="password" id="password" th:value="*{password}" placeholder="Password"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="age" class="col-sm-2 control-label">age</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="age" id="age" th:value="*{age}" placeholder="age"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="submit" value="Submit" class="btn btn-info" />
|
||||
|
||||
<a href="/toAdd" th:href="@{/list}" class="btn btn-info">Back</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,17 +0,0 @@
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
|
||||
#spring.thymeleaf.check-template-location=true
|
||||
#spring.thymeleaf.prefix=classpath:/templates/
|
||||
#spring.thymeleaf.suffix=.html
|
||||
#spring.thymeleaf.mode=HTML
|
||||
#spring.thymeleaf.encoding=UTF-8
|
||||
#spring.thymeleaf.content-type=text/html
|
||||
spring.thymeleaf.cache=false
|
||||
|
||||
spring.jpa.properties.hibernate.hbm2ddl.auto=update
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
spring.jpa.show-sql= true
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Hello Thymeleaf!</title>
|
||||
</head>
|
||||
<body>
|
||||
<p th:text="'Hello, ' + ${name} + '!'" />
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>userList</title>
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"></link>
|
||||
</head>
|
||||
<body class="container">
|
||||
<br/>
|
||||
<h1>用户列表</h1>
|
||||
<br/><br/>
|
||||
<div class="with:80%">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>User Name</th>
|
||||
<th>Password</th>
|
||||
<th>Age</th>
|
||||
<th>Edit</th>
|
||||
<th>Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="user : ${users}">
|
||||
<th scope="row" th:text="${user.id}">1</th>
|
||||
<td th:text="${user.userName}">neo</td>
|
||||
<td th:text="${user.password}">Otto</td>
|
||||
<td th:text="${user.age}">6</td>
|
||||
<td><a th:href="@{/toEdit(id=${user.id})}">edit</a></td>
|
||||
<td><a th:href="@{/delete(id=${user.id})}">delete</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2 control-label">
|
||||
<a href="/toAdd" th:href="@{/toAdd}" class="btn btn-info">add</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>user</title>
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"></link>
|
||||
</head>
|
||||
<body class="container">
|
||||
<br/>
|
||||
<h1>添加用户</h1>
|
||||
<br/><br/>
|
||||
<div class="with:80%">
|
||||
<form class="form-horizontal" th:action="@{/add}" method="post">
|
||||
<div class="form-group">
|
||||
<label for="userName" class="col-sm-2 control-label">userName</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="userName" id="userName" placeholder="userName"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="col-sm-2 control-label" >Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" name="password" id="password" placeholder="Password"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="age" class="col-sm-2 control-label">age</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="age" id="age" placeholder="age"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="submit" value="Submit" class="btn btn-info" />
|
||||
|
||||
<input type="reset" value="Reset" class="btn btn-info" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,44 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>user</title>
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"></link>
|
||||
</head>
|
||||
<body class="container">
|
||||
<br/>
|
||||
<h1>修改用户</h1>
|
||||
<br/><br/>
|
||||
<div class="with:80%">
|
||||
<form class="form-horizontal" th:action="@{/edit}" th:object="${user}" method="post">
|
||||
<input type="hidden" name="id" th:value="*{id}" />
|
||||
<div class="form-group">
|
||||
<label for="userName" class="col-sm-2 control-label">userName</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="userName" id="userName" th:value="*{userName}" placeholder="userName"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="col-sm-2 control-label" >Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" name="password" id="password" th:value="*{password}" placeholder="Password"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="age" class="col-sm-2 control-label">age</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="age" id="age" th:value="*{age}" placeholder="age"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="submit" value="Submit" class="btn btn-info" />
|
||||
|
||||
<a href="/toAdd" th:href="@{/list}" class="btn btn-info">Back</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user