myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng, Xiahong" <Xiahong.Zh...@FMR.COM>
Subject JSF validation question?
Date Thu, 24 Apr 2008 17:42:04 GMT
Two scenarios:

Scenario 1. Form submission:
Our security requirement mandates that we implement some sort of default
validation on fields that do not have validator attached to them. That
is, if validators are missing on the input fields, we have to do some
minimal validation. Otherwise, JSF will do the validation. How would you
go about implementing this requirement. I am thinking several options

A) Use a customized Application implementation which will override
"createComponent" method which delegates to the default ApplicationImpl
to create the component and add my default validator if there is no

   createComponent(String componentType) {

       UIComponent component = delegate.createComponent(componentType);
       if (component instanceof UIInput &&
component.getValidators.length == 0) {
            component.addValidator(new MyDefaultValidator());

B) Create a custom form component to track the input fields with a
similar logic when they are being added the form. This 

Scenario 2. Get request (no form submission):

  JSF does not execute validation phase for GET request. In this case,
how do I validate request parameters passed as managed properties? I
don't want to validate them explicitly in my managed beans. I want the
validation to happen before they are bound. 

Thanks in advance,
Xiaohong Zheng

View raw message