简体   繁体   English

根据MVC设计在哪里放置验证方法GWT

[英]Where to put validation methods GWT according to MVC design

I'm new with GWT and I'm stuck to an issue where to put the validation methods some of them requires asynchronous calls to database my project consists of 2 packages : 我是GWT新手,但我遇到了一个问题:在其中放置验证方法,其中一些方法需要异步调用数据库,我的项目包含2个软件包:

client side where the interface and services classes client side所在的接口服务

server side where entities and serviceImpl classes server side 实体serviceImpl

Do I have to make a third package and place them on it ex: shared ?? 我是否必须制作第三个包装并将其放在ex上:shared or It's Ok to just place them on the client interface classes ex:Login.java 或者可以将它们放在客户端接口类ex:Login.java上

GWT 2.5 comes with support for JSR-303 Bean Validation. GWT 2.5附带了对JSR-303 Bean验证的支持。

See link: https://developers.google.com/web-toolkit/doc/latest/DevGuideValidation?hl=fr 看到链接: https : //developers.google.com/web-toolkit/doc/latest/DevGuideValidation?hl=fr

  • It would be great to completely share the validation code in server and client, but run it in both ends. 完全共享服务器和客户端中的验证代码,但同时在两端运行它,将是很棒的。

    As all said ,good things in client side validation : 众所周知,在client side validation好处:

  • Immediate feedback without server visit . Immediate feedback无需访问服务器。

  • If client side validation is used, server side validation is still needed 如果使用client side validation ,则仍然需要server side validation

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

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