简体   繁体   中英

Struts 1.2 server-Side JavaScript Validation

I am new to struts , I need a serverside Java script Validation in struts 1.2. 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

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

 $('#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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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