I’ve seen others use a customised version of DWR in combination with
annotations. We looked at it to the point of almost going with it but in the
end the decision was made it wasn’t worth the effort.

We have little in the way of duplication. The approach we took was to be all
nice-nice on the JS validation with regards to client feedback and then be
more abrupt on the server side as we could assume that if the client side
validation failed, either somebody was doing something they shouldn’t be or
something had gone wrong in a big way.  If server side validation failed on
items that JS had supposedly validated we just threw the user to an error
page.

I like the looks of the JSONValidation Interceptor, but I’m just a little
concerned about the number of round trips. It looks like each form
submission occurs twice, once for validation via ajax and a second regular
HTTP request after.

Z.
> 
> @Wes : Thanks for the samples, I'll check it. The struts2-jquery-plugin you
> are talking about is the same as the one released in 1.0 last night ?
> @Martin : I agree. Coordinating the 2 layers (ie. client-side & server-side
> validation) is one of my main goal to avoid rewriting validation rules
> twice, possibly in 2 different languages.
> 
> Cheers,
> 
> Nicolas
> 
> On Tue, Jul 28, 2009 at 1:41 PM, Martin Gainty <mgai...@hotmail.com> wrote:
> 
>> >
>> > is JS validation thru a JS function faster than allowing the
>> > FieldValidationInterceptor to verify?
>> > is there a way to coordinate validations between the 2 layers (so that the
>> > effort is not duplicated)
>> > possibly an advised method from spring?
>> >
>> > 
>> http://struts.apache.org/2.1.2/struts2-core/apidocs/com/opensymphony/xwork2/v
>> alidator/annotations/RequiredFieldValidator.html
>> >
>> > thanks,
>> > Martin
>> > ______________________________________________
>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>> >
>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> > dient lediglich dem Austausch von Informationen und entfaltet keine
>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> > aucune responsabilité pour le contenu fourni.
>> >
>> >
>> >
>> >
>>> > > Date: Tue, 28 Jul 2009 21:51:44 +1000
>>> > > Subject: Re: AJAX Validation
>>> > > From: zo...@sparecreative.com
>>> > > To: user@struts.apache.org
>>> > >
>>> > > It depends on the approach you want to take in validation.
>>> > >
>>> > > For security reasons we run two layers of validation, a simple model
>> > using
>>> > > jQuery checking mandatory fields and limits checks and then a more
>> > rigorous
>>> > > model server side.
>>> > >
>>> > > As for setting up, we looked at how it was done with S2 and dojo, in the
>> > end
>>> > > we found it it much easier just to program directly when creating the
>> > form
>>> > > pages. Because of the powerful selectors  in jQuery and judicious use of
>>> > > listeners we¹ve had no issue with maintenance of code and we¹ve been >>>
able
>> > to
>>> > > leverage a range of plugins available for jQuery.
>>> > >
>>> > > Originally we tried to have the scripts created automagically through
>>> > > programming, but in the end it wasn¹t worth the effort. We¹ve extended
>> > the
>>> > > CSS and XHTML templates to accommodate some time saving features but on
>> > the
>>> > > whole there wasn¹t much to it.
>>> > >
>>> > > I now find it quicker to setup the validation directly rather than
>> > setting
>>> > > up the XML files. It¹s amazing what can be achieved with a few well
>> > placed
>>> > > s:if tags and some JS code.
>>> > >
>>> > > Z.
>>> > >
>>>> > > >
>>>> > > > Hi Zoran,
>>>> > > >
>>>> > > > Thank you for your answer. Since you are using JQuery directly, how
do
>> > you
>>>> > > > perform data validation ? Is it possible to use the XML Files or
>> > annotations
>>>> > > > provided by Struts ?
>>>> > > >
>>>> > > > Cheers,
>>>> > > >
>>>> > > > Nicolas
>>>> > > >
>>>> > > > On Tue, Jul 28, 2009 at 11:26 AM, Zoran Avtarovski
>>>> > > > <zo...@sparecreative.com>wrote:
>>>> > > >
>>>>>> > > >> > From what I can tell Dojo has been moved out into a plugin, but
>> > still
>>>>>> > > >> > exists.
>>>>>> > > >> >
>>>>>> > > >> > Honestly though, I¹d take the opportunity move away from an
>> > integrated
>>>>>> > > >> > solution to using a javascript framework directly.
>>>>>> > > >> >
>>>>>> > > >> > We use jQuery and it integrates with Struts without any major
issues
>> > and
>>>>>> > > >> > more often than not offers much greater flexibility. I know of
>> > others who
>>>>>> > > >> > use dojo, mootools and prototype without any issues.
>>>>>> > > >> >
>>>>>> > > >> > Z.
>>>>>>>> > > >>> > >
>>>>>>>> > > >>> > > Hi everybody,
>>>>>>>> > > >>> > >
>>>>>>>> > > >>> > > I'm currently working on a project based on Struts 2.0.11.
We're
>>>>>> > > >>> planning
>>>>>> > > >> > to
>>>>>>>> > > >>> > > migrate to the last 2.1.x version but I've just seen that
the
>> > Dojo
>>>>>> > > >>> plugin
>>>>>>>> > > >>> > > has been deprecating. Consequently, what's your
>>>>>>>> recommandation to
>>>>>> > > >>> perform
>>>>>>>> > > >>> > > proper AJAX validation since the example on the Wiki is
still
>> > based on
>>>>>> > > >> > the
>>>>>>>> > > >>> > > Dojo plugin ? Which plugin will be the next standard for
Ajax
>> > tags in
>>>>>> > > >> > Struts
>>>>>>>> > > >>> > > 2 ? JQuery plugin ?
>>>>>>>> > > >>> > >
>>>>>>>> > > >>> > > Thanks in advance for your answers,
>>>>>>>> > > >>> > >
>>>>>>>> > > >>> > > Regards,
>>>>>>>> > > >>> > >
>>>>>>>> > > >>> > > Nicolas
>>>>>> > > >> >
>>>>>> > > >> >
>>>>>> > > >> >
>>>> > > >
>>> > >
>>> > >
>> >
>> > _________________________________________________________________
>> > Bing™ brings you maps, menus, and reviews organized in one place. Try it
>> > now.
>> >
>> > 
>> http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TXT_ML
>> OGEN_Local_Local_Restaurants_1x1
> 
> 
> 
> ...........................................................


Reply via email to