Bonjour,

J'ai réalisé un simple formulaire ou l'on renseigne le mail et le but c'est de supprimer la ligne où le mail inscrit dans le champs correspond:

Voici la page du formulaire :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Formulaire d'inscription</title>
</head>
<body>
	<h1>Créer votre compte</h1>
	<form action="ajouter" method="post">
		<input type="text" name="prenom" placeholder="prenom"/><br>
		<input type="text" name="nom" placeholder="nom"/><br>
		<input type="text" name="mail" placeholder="addresse mail"/><br>
		<input type="submit" value="créer" name="creer"/>
	</form>
	<hr>
	<h1>Supprimer votre compte</h1>
	<form action="supprimer" method="post">
		<input type="email" name="mail" placeholder="addresse mail"/><br>
		<input type="submit" value="supprimer" name="supprimer"/>
	</form>
</body>
</html>
Mon api :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
package com.Swinolani.Eval.Controlleur;
 
import java.util.ArrayList;
import java.util.Map;
 
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.Swinolani.Eval.bdd.BddClientRequest;
 
@RestController
public class Supprimer {
	private BddClientRequest clientBddRepo;
	public Supprimer(BddClientRequest clientBddRepo) {
		this.clientBddRepo = clientBddRepo;
	}
	@PostMapping("/supprimer")
	public String SupprClient(@RequestParam Map<String,String> param) {
		//Code pour recup tous les mails dans la bdd
		ArrayList<String> listMail=new ArrayList<>();
		for(int i =0;i<clientBddRepo.findAll().size();i++) {
			listMail.add(clientBddRepo.findAll().get(i).getCli_mail());
		}
		//Si le mail inscrit se trouve dans la bdd
		if(param.containsValue("supprimer") && listMail.contains(param.get("mail")) ) {
			clientBddRepo.delete(null);//??
			return "<h1>Suppression avec succés</h1>";
		}else {
			return "<h1>Le mail n'existe pas dans la base</h1>";
		}
 
	}
}
L'anomalie se trouve à la ligne 29 (la ligne de code est par défaut ce que j'ai noté mais c'est juste pour mettre un truc).
Merci d'avance .