mi piacerebbe utilizzare la nuova <input type="email" />
elemento. Mi piacerebbe avere un codice Java che implementa la stessa validazione sul server che avviene nel browser.Esiste un'implementazione Java della convalida dell'email di input HTML5?
The HTML5 spec defines email addresses in ABNF come:
1*(atext/".") "@" ldh-str *("." ldh-str)
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9
and:
atext = ALPHA/DIGIT/ ; Printable US-ASCII
"!"/"#"/ ; characters not including
"$"/"%"/ ; specials. Used for atoms.
"&"/"'"/
"*"/"+"/
"-"/"/"/
"="/"?"/
"^"/"_"/
"`"/"{"/
"|"/"}"/
"~"
Questi sono non le stesse regole come in 01.236.108,938 mila. Come posso verificare che un indirizzo sia conforme a queste regole in Java?
Grazie!
non so se esiste una soluzione ready-made, ma se non è possibile trovare qualsiasi, è possibile abbastanza facilmente crearne uno con PEP. http://www.ling.ohio-state.edu/~scott/ – biziclop