您如何避免服务器和客户端上的验证重复? [英] How do you avoid duplication of validation on the server and client-side?

查看:71
本文介绍了您如何避免服务器和客户端上的验证重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何避免在服务器和客户端重复验证?是否有一个Web编程平台可以彼此生成,所以我不必使两者保持同步?

How do you avoid duplication of validation on the server and client-side? Is there a web programming platform that generates one from the other, so I don't have to keep the two in sync?

推荐答案

有些框架可以从服务器端验证配置中生成客户端验证。

There are frameworks that can generate the client-side validation from serverside validation configuration.

现在我不知道您使用的是哪种语言或框架,但也许这篇文章对您有所帮助: http://www.emadibrahim.com/2008/09/08/client-server- side-validation-in-aspnet-mvc /

Now I don't know what language or frameworks you are using, but maybe this article can be of help: http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/

他正在使用Castle Validator Component和JQuery,并添加了一些胶以基于服务器端生成客户端验证验证属性。适用于asp.net mvc。

He's using Castle Validator Component together with JQuery and adds some glue to generate the clientside validation based on the serverside validation attributes. It's for asp.net mvc.

/ Asger

这篇关于您如何避免服务器和客户端上的验证重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆