Formulaire incription utilisateur
This commit is contained in:
@@ -22,7 +22,7 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
|
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
|
||||||
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.4'
|
implementation 'org.mariadb.jdbc:mariadb-java-client:2.2.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ public interface UserService {
|
|||||||
List<User> listeUtilisateurs();
|
List<User> listeUtilisateurs();
|
||||||
User utilisateur(int id);
|
User utilisateur(int id);
|
||||||
void setUtilisateur(User utilisateur);
|
void setUtilisateur(User utilisateur);
|
||||||
void editUtilisateur(int id);
|
|
||||||
void deleteUtilisateur(int id);
|
void deleteUtilisateur(int id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
userRepository.save(utilisateur);
|
userRepository.save(utilisateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void editUtilisateur(int id) {
|
|
||||||
userRepository.edit(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteUtilisateur(int id) {
|
public void deleteUtilisateur(int id) {
|
||||||
userRepository.delete(id);
|
userRepository.delete(id);
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ public class InscriptionController {
|
|||||||
|
|
||||||
@PostMapping("/newUser")
|
@PostMapping("/newUser")
|
||||||
public String setUser(@ModelAttribute User user) {
|
public String setUser(@ModelAttribute User user) {
|
||||||
System.out.println(user.getId());
|
userService.setUtilisateur(user);
|
||||||
//userService.setUtilisateur(user);
|
|
||||||
return "redirect:/accueil";
|
return "redirect:/accueil";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ public interface UserRepository {
|
|||||||
List<User> findAll();
|
List<User> findAll();
|
||||||
User findById(int id);
|
User findById(int id);
|
||||||
void save(User utilisateur);
|
void save(User utilisateur);
|
||||||
void edit(int id);
|
|
||||||
void delete(int id);
|
void delete(int id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,19 +49,14 @@ public class UserRepositoryImpl implements UserRepository {
|
|||||||
parameters.addValue("code_postal", utilisateur.getCode_postal());
|
parameters.addValue("code_postal", utilisateur.getCode_postal());
|
||||||
parameters.addValue("ville", utilisateur.getVille());
|
parameters.addValue("ville", utilisateur.getVille());
|
||||||
parameters.addValue("mot_de_passe", utilisateur.getPassword());
|
parameters.addValue("mot_de_passe", utilisateur.getPassword());
|
||||||
|
System.out.println(keyHolder);
|
||||||
jdbcTemplate.update(sql, parameters, keyHolder ,new String[] {"id"} );
|
jdbcTemplate.update(sql, parameters);
|
||||||
utilisateur.setId(keyHolder.getKey().intValue());
|
//utilisateur.setId(keyHolder.getKey().intValue());
|
||||||
}else {
|
}else {
|
||||||
//Mettre à jour
|
//Mettre à jour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void edit(int id) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(int id) {
|
public void delete(int id) {
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,3 @@
|
|||||||
spring.datasource.url=jdbc:mariadb://91.121.54.36:3306/eni_enchere
|
spring.datasource.url=jdbc:mariadb://91.121.54.36:3306/eni_enchere
|
||||||
spring.datasource.username=eni
|
spring.datasource.username=eni
|
||||||
spring.datasource.password=Pa$$w0rd
|
spring.datasource.password=Pa$$w0rd
|
||||||
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<!-- Ajouter la page de nav bar -->
|
<!-- Ajouter la page de nav bar -->
|
||||||
<div id="container-main">
|
<div id="container-main">
|
||||||
<form th:action="@{/newUser}" method="post" th:object="${user}">
|
<form th:action="@{/inscription/newUser}" method="post" th:object="${user}">
|
||||||
<!--<div class="erreur-saisie" th:if="${#fields.hasErrors('*')}" >
|
<!--<div class="erreur-saisie" th:if="${#fields.hasErrors('*')}" >
|
||||||
<p th:text="#{index.erreurs}">Message d'erreur</p>
|
<p th:text="#{index.erreurs}">Message d'erreur</p>
|
||||||
</div>-->
|
</div>-->
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<div class="champ-saisie">
|
<div class="champ-saisie">
|
||||||
<label for="telephone">Téléphone: </label>
|
<label for="telephone">Téléphone: </label>
|
||||||
<div>
|
<div>
|
||||||
<input type="tel" th:field="*{telephone}" id="telephone" />
|
<input type="text" th:field="*{telephone}" id="telephone" />
|
||||||
</div>
|
</div>
|
||||||
<span style="color: red;" th:if="${#fields.hasErrors('telephone')}">
|
<span style="color: red;" th:if="${#fields.hasErrors('telephone')}">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
<div class="champ-saisie">
|
<div class="champ-saisie">
|
||||||
<label for="code_postal">Code postal: </label>
|
<label for="code_postal">Code postal: </label>
|
||||||
<div>
|
<div>
|
||||||
<input type="number" th:field="*{code_postal}" id="code_postal" />
|
<input type="text" th:field="*{code_postal}" id="code_postal" />
|
||||||
</div>
|
</div>
|
||||||
<span style="color: red;" th:if="${#fields.hasErrors('code_postal')}">
|
<span style="color: red;" th:if="${#fields.hasErrors('code_postal')}">
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user