简体   繁体   English

Struts 1.2服务器端JavaScript验证

[英]Struts 1.2 server-Side JavaScript Validation

I am new to struts , I need a serverside Java script Validation in struts 1.2. 我是struts的新手,我需要struts 1.2中的服务器端Java脚本验证。 I did a lot of googling but did not get anything useful 我做了很多谷歌搜索,但没有得到任何有用的东西

Server side validation with page refersh and page error is easy , But i do not have idea about how to prompt with Javascript and then display the same jsp page 使用页面referh和页面错误的服务器端验证很容易,但我不知道如何使用Javascript提示然后显示相同的jsp页面

Thanks in advance 提前致谢

any link , simple example could be useful 任何链接,简单的例子都可能有用

推荐您https://github.com/koorchik/LIVR我使用了很长时间尝试使用您可以使用http://webbylab.github.io/livr-playground

If you want the client side form validation, you can try bootstrap validator as following 如果要进行客户端表单验证,可以尝试使用bootstrap验证器,如下所示

 $('#yourForm') .formValidation({ framework: 'bootstrap', icon: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { email: { validators: { notEmpty: { message: 'Please provide email address' }, emailAddress: { message: 'The value is not a valid email address' } } } } }) 

If you want to validate the email is already registered in the database, you need javascript Ajax call. 如果要验证电子邮件已在数据库中注册,则需要javascript Ajax调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM