开发者

spring roo gwt client side validation

I'm trying to add client side validations in GWT (using Spring too) to the sample expenses project, and in file AbstractProxyEditActivity.java the following is the code

RequestContext request = editorDriver.flush();
if (editorDriver.hasErrors()) {
    return;
}

But it is not throwing any errors, could you please tell me how this works, and any useful & important links on the same would be great !!

How does .flush & .hasErrors work, and where are t开发者_开发问答hey checked !!


Please try debugging when your code is run.


in my project, I do something like that:

First I made a default way to show the error msgs.

Second, in client package, i have classes to do client side validations, like empty fields and simple business rules. This classes returns a object that contains the fields with errors and the messages i have to show to user.

In server package, I can have another validation class, that do validations that need to verify DB and other things. This class return the same type of object that the client validation.

So, in my Activity/Presenter, i call my client validation, if is ok, i call the method that i have to call (save, by example), and the save method runs server validations and more, returning the same result type as i said before.

I never used spring-roo and dont know how it works, so, if i said something useless, please forgive me.

hope it helps.


As for the links you can visit this blog http://gwtsts.blogspot.com/, it is dedicated to explaining the GWT code generated by ROO and how to customize it. You can also watch the "Google I/O 2010 - Architecting GWT apps" presentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜