You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nicolas Baron <nb...@octo.com> on 2009/07/28 11:55:00 UTC

AJAX Validation

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

Re: AJAX Validation

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
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 <mg...@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: zoran@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
> 
> 
> 
> ...........................................................



Re: AJAX Validation

Posted by Nicolas Baron <nb...@octo.com>.
Very clear. I'll check what you've just mentionned and try to find the best
strategy related to our context.
Thanks a lot your help.

Nicolas

On Tue, Jul 28, 2009 at 1:54 PM, Wes Wannemacher <we...@wantii.com> wrote:

> On Tue, Jul 28, 2009 at 9:48 AM, Nicolas Baron<nb...@octo.com> wrote:
> > @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 ?
>
> No, this is different. When I started this one (many moons ago), I
> knew of at least a few other plugins, but they were concentrating on
> adding widgets and other eye candy. I decided to take this and work on
> form submission with validation, then add eye candy later. The recent
> release announced on dev is the reason why I mentioned that my plugin
> is awaiting future direction. I only pointed to it because it provides
> some examples of how to do the ajax form processing with validation.
>
> -Wes
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
..........................................................
Nicolas BARON
Architecte
OCTO Technology Maroc
..........................................................
59, av Fal Ould Oumeir
Rabat Agdal - Maroc
GSM : (212) 661 46 20 38
http://www.octo.com/
...........................................................

Re: AJAX Validation

Posted by Wes Wannemacher <we...@wantii.com>.
On Tue, Jul 28, 2009 at 9:48 AM, Nicolas Baron<nb...@octo.com> wrote:
> @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 ?

No, this is different. When I started this one (many moons ago), I
knew of at least a few other plugins, but they were concentrating on
adding widgets and other eye candy. I decided to take this and work on
form submission with validation, then add eye candy later. The recent
release announced on dev is the reason why I mentioned that my plugin
is awaiting future direction. I only pointed to it because it provides
some examples of how to do the ajax form processing with validation.

-Wes

-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX Validation

Posted by Nicolas Baron <nb...@octo.com>.
@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 <mg...@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/validator/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: zoran@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_MLOGEN_Local_Local_Restaurants_1x1



...........................................................

RE: AJAX Validation

Posted by Martin Gainty <mg...@hotmail.com>.
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/validator/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: zoran@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_MLOGEN_Local_Local_Restaurants_1x1

Re: AJAX Validation

Posted by Dale Newfield <da...@newfield.org>.
Wes Wannemacher wrote:
> why don't you put in a JIRA

Done:  https://issues.apache.org/struts/browse/WW-3206

(although it's more a documentation fix than anything else)

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX Validation

Posted by Wes Wannemacher <we...@wantii.com>.
On Tue, Jul 28, 2009 at 9:48 AM, Dale Newfield<da...@newfield.org> wrote:
> Wes Wannemacher wrote:
>>
>> There is an interceptor called JSONValidation (or something like
>> that). If you cruise to the bottom of this page, you will see an
>> example of using it with Prototype -
>>
>> http://struts.apache.org/2.x/docs/ajax-validation.html
>
> That's fairly slick, but I wonder if there's a way to prevent the validation
> form submission from uploading files an additional time?
>
> -Dale
>

Dale, I've never looked into that, but it's a valid point, why don't
you put in a JIRA. I think it would be pretty easy to say something
like - hey, if this is a multipart/form-data encoding type, let's take
a different course of action.

-Wes



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX Validation

Posted by Dale Newfield <da...@newfield.org>.
Wes Wannemacher wrote:
> There is an interceptor called JSONValidation (or something like
> that). If you cruise to the bottom of this page, you will see an
> example of using it with Prototype -
> 
> http://struts.apache.org/2.x/docs/ajax-validation.html

That's fairly slick, but I wonder if there's a way to prevent the 
validation form submission from uploading files an additional time?

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX Validation

Posted by Wes Wannemacher <we...@wantii.com>.
There is an interceptor called JSONValidation (or something like
that). If you cruise to the bottom of this page, you will see an
example of using it with Prototype -

http://struts.apache.org/2.x/docs/ajax-validation.html

I started a JQuery plugin that is sitting in the sandbox right now
waiting for some direction, but I used this technique and if you're
willing to wade through some code you can see how to use the
JSONValidator in a very struts-y way. Also, there is a showcase where
I put examples of AJAX form handling (with validation).

http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-jquery-plugin/
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/

-Wes

On Tue, Jul 28, 2009 at 7:30 AM, Nicolas Baron<nb...@octo.com> wrote:
> 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
>>
>>
>>
>
>
> --
> ..........................................................
> Nicolas BARON
> Architecte
> OCTO Technology Maroc
> ..........................................................
> 59, av Fal Ould Oumeir
> Rabat Agdal - Maroc
> GSM : (212) 661 46 20 38
> http://www.octo.com/
> ...........................................................
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX Validation

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
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
>> >
>> >
>> >
> 



Re: AJAX Validation

Posted by Nicolas Baron <nb...@octo.com>.
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
>
>
>


-- 
..........................................................
Nicolas BARON
Architecte
OCTO Technology Maroc
..........................................................
59, av Fal Ould Oumeir
Rabat Agdal - Maroc
GSM : (212) 661 46 20 38
http://www.octo.com/
...........................................................

Re: AJAX Validation

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
>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