我想使用新的<input type="email" />
元素。我想让Java代码在服务器上实现与浏览器中相同的验证。是否有HTML5输入电子邮件验证的Java实现?
在ABNFThe HTML5 spec defines email addresses为:
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.
"&"/"'"/
"*"/"+"/
"-"/"/"/
"="/"?"/
"^"/"_"/
"`"/"{"/
"|"/"}"/
"~"
这些不相同的规则,如RFC 5322。 如何测试地址是否符合Java中的这些规则?
谢谢!
我不知道现成的解决方案是否存在,但如果找不到任何解决方案,则可以非常容易地使用PEP创建解决方案。 http://www.ling.ohio-state.edu/~scott/ – biziclop 2011-02-09 00:26:02