You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Martin Marinschek <ma...@gmail.com> on 2006/01/11 14:31:18 UTC

Fwd: Questions regarding client validators

1) you say JSF file - you mean js, right?


On 1/11/06, Cagatay Civici <ca...@gmail.com> wrote:
> Hi Martin,
>
> I am working on integrating the client validators to tomahawk now and have a
> couple of questions, hope you don't mind.
>
> 1) I am using a .jsf file, where should I put this file exactly, I guess,
>
> tomahawk\src\main\resources\org\apache\myfaces\custom\clientvalidators\resource\clientvalidators.js
>
> 2) I observed in myfaces there is an extensions filter to serve the
> resources like javascript files from jar instead of using them externally.
> What should I do to add this feature to my code, I've tried AddResouce but
> could not make it right I guess.
>
> 3) I have added a package name clientvalidators under tomahawk, there are a
> total of 6 different components I implemented and how should be the the
> folder structure? Should I seperate each component or put them all under one
> folder, I mean;
>
> org\apache\myfaces\custom\clientvalidators\RequiredFieldValidatorTag.java
> or
> org\apache\myfaces\custom\clientvalidators\RequiredFieldValidator\RequiredFieldValidatorTag.java,
> etc.
>
> 4) I am still confused about this resource location, I'am still seeing same
> resources under;
> \tomahawk\src\main\java\org\apache\myfaces\custom\popup\resource\popup.js
> \tomahawk\src\main\resources\org\apache\myfaces\custom\popup\resource\popup.js
>
> So far, I've managed to integrate my code to tomahawk, have a build, deploy
> and test OK. The js file is used externally during my tests, both mozilla
> and ie are supported now.
>
> Thank you for your time,
>
> Regards,
>
> Cagatay,
>
>
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Questions regarding client validators

Posted by Martin Marinschek <ma...@gmail.com>.
Sorry Catagay,

I meant to answer all your mail, but did not obviously.

Now what do you say to Adam's suggestion of using the ADF faces code for this?

Is there anything that your extended validators (and I suppose you
have extended validators, too, which do both server and client-side
validation, right?) add en plus?

regards,

Martin

On 1/11/06, Martin Marinschek <ma...@gmail.com> wrote:
> 1) you say JSF file - you mean js, right?
>
>
> On 1/11/06, Cagatay Civici <ca...@gmail.com> wrote:
> > Hi Martin,
> >
> > I am working on integrating the client validators to tomahawk now and have a
> > couple of questions, hope you don't mind.
> >
> > 1) I am using a .jsf file, where should I put this file exactly, I guess,
> >
> > tomahawk\src\main\resources\org\apache\myfaces\custom\clientvalidators\resource\clientvalidators.js
> >
> > 2) I observed in myfaces there is an extensions filter to serve the
> > resources like javascript files from jar instead of using them externally.
> > What should I do to add this feature to my code, I've tried AddResouce but
> > could not make it right I guess.
> >
> > 3) I have added a package name clientvalidators under tomahawk, there are a
> > total of 6 different components I implemented and how should be the the
> > folder structure? Should I seperate each component or put them all under one
> > folder, I mean;
> >
> > org\apache\myfaces\custom\clientvalidators\RequiredFieldValidatorTag.java
> > or
> > org\apache\myfaces\custom\clientvalidators\RequiredFieldValidator\RequiredFieldValidatorTag.java,
> > etc.
> >
> > 4) I am still confused about this resource location, I'am still seeing same
> > resources under;
> > \tomahawk\src\main\java\org\apache\myfaces\custom\popup\resource\popup.js
> > \tomahawk\src\main\resources\org\apache\myfaces\custom\popup\resource\popup.js
> >
> > So far, I've managed to integrate my code to tomahawk, have a build, deploy
> > and test OK. The js file is used externally during my tests, both mozilla
> > and ie are supported now.
> >
> > Thank you for your time,
> >
> > Regards,
> >
> > Cagatay,
> >
> >
> >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Questions regarding client validators

Posted by Simon Kitching <sk...@obsidium.com>.
Manfred Geiler wrote:
>> This is more than just a nice feature - it's architecturally very
>> important that web applications always have client-side
>> validation as a subset of server-side validation (maybe equals,
>> but never ever more);  so it's dangerous to let people get in
>> the habit of separately adding client-side validation in case they
>> start thinking "hey, I already validated on the client, I can
>> save time and not re-validate on the server".
> 
> Yes, client-side validation in a webapp is always no more than a
> feature and business logic must never rely on it. 

I agree with this too. MyFaces should *not* include components that do 
*only* client-side validation; that's not safe.

In general, the standard JSF validators are fine; we just need to add 
the ability for them to generate client-side validation script in 
addition to the server-side stuff they already do. I thought that was 
what the recent client-side-validation proposals were about...


Regards,

Simon

Re: Questions regarding client validators

Posted by Manfred Geiler <ma...@gmail.com>.
> This is more than just a nice feature - it's architecturally very
> important that web applications always have client-side
> validation as a subset of server-side validation (maybe equals,
> but never ever more);  so it's dangerous to let people get in
> the habit of separately adding client-side validation in case they
> start thinking "hey, I already validated on the client, I can
> save time and not re-validate on the server".

Yes, client-side validation in a webapp is always no more than a
feature and business logic must never rely on it. That's what I always
preach, too.
Even more. Serious validation has (at least) 3 phases:
1. client side: not too complex (e.g. required field, numeric, valid date)
2. server side presentation tier: same as client side, just to guard
against client validation failures
3. business logic tier: complex validation, e.g. "Is the data
consistent with what the user entered in a previous form?" or "Is the
entered number really a prime" - may be difficult both in client
javascript and BL if it is a really big num ;-)

Manfred

Re: Questions regarding client validators

Posted by Adam Winer <aw...@gmail.com>.
Hey, guys, now that there's actually ADF Faces source code
to point you at - can I point you at the ADF Faces code that
does client validation?

The general approach we use is that client-side validation happens
"magically":  you add a JSF validator, converter, or set "required",
and we automatically figure out what client-side validation is needed
and render it without further prodding from the page author.  This
happens with some optional interfaces that a validator or
converter can add.

This is more than just a nice feature - it's architecturally very
important that web applications always have client-side
validation as a subset of server-side validation (maybe equals,
but never ever more);  so it's dangerous to let people get in
the habit of separately adding client-side validation in case they
start thinking "hey, I already validated on the client, I can
save time and not re-validate on the server".

-- Adam


On 1/11/06, Martin Marinschek <ma...@gmail.com> wrote:
> 1) you say JSF file - you mean js, right?
>
>
> On 1/11/06, Cagatay Civici <ca...@gmail.com> wrote:
> > Hi Martin,
> >
> > I am working on integrating the client validators to tomahawk now and have a
> > couple of questions, hope you don't mind.
> >
> > 1) I am using a .jsf file, where should I put this file exactly, I guess,
> >
> > tomahawk\src\main\resources\org\apache\myfaces\custom\clientvalidators\resource\clientvalidators.js
> >
> > 2) I observed in myfaces there is an extensions filter to serve the
> > resources like javascript files from jar instead of using them externally.
> > What should I do to add this feature to my code, I've tried AddResouce but
> > could not make it right I guess.
> >
> > 3) I have added a package name clientvalidators under tomahawk, there are a
> > total of 6 different components I implemented and how should be the the
> > folder structure? Should I seperate each component or put them all under one
> > folder, I mean;
> >
> > org\apache\myfaces\custom\clientvalidators\RequiredFieldValidatorTag.java
> > or
> > org\apache\myfaces\custom\clientvalidators\RequiredFieldValidator\RequiredFieldValidatorTag.java,
> > etc.
> >
> > 4) I am still confused about this resource location, I'am still seeing same
> > resources under;
> > \tomahawk\src\main\java\org\apache\myfaces\custom\popup\resource\popup.js
> > \tomahawk\src\main\resources\org\apache\myfaces\custom\popup\resource\popup.js
> >
> > So far, I've managed to integrate my code to tomahawk, have a build, deploy
> > and test OK. The js file is used externally during my tests, both mozilla
> > and ie are supported now.
> >
> > Thank you for your time,
> >
> > Regards,
> >
> > Cagatay,
> >
> >
> >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>