打开APP
未登录
开通VIP,畅享免费电子书等14项超值服
开通VIP
首页
好书
留言交流
下载APP
联系客服
Struts2 validation
LibraryPKU
>《J2EE》
2013.09.21
关注
Please could anybody help me?
I am trying use Struts2 validation but in still doesn't work and I don't know why.
I have form
view plain
copy to clipboard
print
?
Note: Text content in the code blocks is automatically word-wrapped
<s:form action=
"addManager"
method=
"post"
enctype=
"multipart/form-data"
validate=
"true"
>
<s:textfield name=
"user.email"
label=
"Kontaktní email"
/>
etc.
etc.
<s:submit value=
"Registrovat"
/>
</s:form>
where I want validate an email.
I have action class ViewUser and XML validationFile ViewUser-validation.xml in same package.
ViewUser-validation.xml contains
view plain
copy to clipboard
print
?
Note: Text content in the code blocks is automatically word-wrapped
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator 1.0.3//EN"
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"
>
<validators>
<field name=
"user.email"
>
<field-validator type=
"requiredstring"
>
<field-validator type=
"requiredstring"
>
<message key=
"errors.required"
/>
</field-validator>
<field-validator type=
"email"
>
<message key=
"errors.invalid"
/>
</field-validator>
</field-validator>
</validators>
Has anybody any idea why it doesn't work? When I put to email editBox not email value nothing happened.
I looks like when it doesn't know about validation file. Validation file should name MyActionClass-validation.xml I think it's ok.
I use Maven2 is possible problem could be there?
Thanks so much
your validation.xml contains invalid validation syntax it should be as follow.
view plain
copy to clipboard
print
?
Note: Text content in the code blocks is automatically word-wrapped
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator 1.0.3//EN"
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"
>
<validators>
<field name=
"user.email"
>
<field-validator type=
"requiredstring"
>
<message key=
"errors.required"
/>
</field-validator>
<field-validator type=
"email"
>
<message key=
"errors.invalid"
/>
</field-validator>
</validators>
you placed
<field-validator>
inside another
<field-validator>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报
。
打开APP,阅读全文并永久保存
查看更多类似文章
猜你喜欢
类似文章
【热】
打开小程序,算一算2024你的财运
Struts2――表单验证
Struts2框架验证
Struts2 的表单验证
关于struts2 验证框架在联网的时候可以用,不联网不起作用的问题
hk编写扩展Struts Validator校验密码输入
Struts Validator验证器使用指南
更多类似文章 >>
生活服务
热点新闻
留言交流
回顶部
联系我们
分享
收藏
点击这里,查看已保存的文章
导长图
关注
一键复制
下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!
联系客服
微信登录中...
请勿关闭此页面
先别划走!
送你5元优惠券,购买VIP限时立减!
5
元
优惠券
优惠券还有
10:00
过期
马上使用
×