salut,
mon but est de faire la validation d'un formulaire d'ajout d'une facture
avec le principe d'annotation et intercepteur
j'arrive à faire validation avec fichier xml mais comme je dis je veux le faire avec annotation et intercepteur
mon application contient deux partie partie web avec struts2 et aprtie EJB
class persistence Facture
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
37
38
39
40 public class Facture { private int IdFacture; private String reference; private String libelle; @Id @GeneratedValue(strategy = GenerationType.AUTO) public int getIdFacture() { return IdFacture; } public void setIdFacture(int idFacture) { IdFacture = idFacture; } public String getReference() { return reference; } public void setReference(String reference) { this.reference = reference; } public String getLibelle() { return libelle; } public void setLibelle(String libelle) { this.libelle = libelle; } public Facture(int idFacture, String reference, String libelle) { super(); IdFacture = idFacture; this.reference = reference; this.libelle = libelle; } public Facture() { // TODO Auto-generated constructor stub } }
la page addFacture.jsp
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 ]<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <s:form action="insertFacture" method="post"> <s:label value="reference"/> <s:textfield name="facture.reference" /> <s:label value="libelle"/> <s:textfield name="facture.libelle" /> <s:submit value="Submit" /> </s:form> </body> </html>
Partager