You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by laredotornado <la...@gmail.com> on 2009/11/19 18:04:57 UTC

Does the validation life cycle get logged anywhere?

Hi,

I'm using MyFaces 1.1.6 with JBoss 5.1.  Is there somewhere that keeps a
record of calling a particular validator method for a component?  I'm asking
because I have this code ...

			  	<h:selectOneMenu validator="#{domeTour.validateValueNotEmpty}"
styleClass="hourMenu" id="domeTourTime1" value="#{domeTour.prefs[0].time}">
			    	<f:selectItems value="#{domeTour.timePrefItems}"/>
			  	</h:selectOneMenu>

with this backing bean validator code ...

	public void validateValueNotEmpty(FacesContext context, UIComponent
component, Object value)
		throws ValidatorException {
		String clientId = component.getClientId(context);
		LOGGER.info("calling special validator method for " + clientId);
		TourRequiredIfCheckedValidator.doRequiredIfCheckedLogic(context, clientId,
value);
	}	// validate

but the log statement never shows up in my log, leading me to believe the
validator method is never being invoked.  I'm looking for a more formal way
to prove that.

Thanks for your help, - Dave
-- 
View this message in context: http://old.nabble.com/Does-the-validation-life-cycle-get-logged-anywhere--tp26421394p26421394.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Does the validation life cycle get logged anywhere?

Posted by Mike Kienenberger <mk...@gmail.com>.
Yes, if you leave the line blank, there won't be any validation.

The line would go in whatever logging configuration file you're using.

For me, it goes in log4j.properties in the root of my classpath.

On Fri, Nov 20, 2009 at 2:24 PM, laredotornado <la...@gmail.com> wrote:
>
> Is it true that if you have a custom validator set up for the input, but you
> leave the input field empty, your validator will not get invoked?
>
> Also, where does this line
>
> org.apache.myfaces.lifecycle.LifecycleImpl = trace
>
> go?  Thanks, - Dave
>
>
>
> Mike Kienenberger wrote:
>>
>> This is for 1.2, but it's probably the same.
>>
>> org.apache.myfaces.lifecycle.LifecycleImpl = trace
>>
>> will log the lifecycle.  Seems like this should really be debug level.
>>
>> Most of the time it's a lifecycle issue rather than a validation issue.
>>
>> Sometimes making sure you have a message/messages component is
>> sufficient to identify the problem.
>>
>> I don't see any logging for UIInput, but you can set a breakpoint at
>> processValidators() if neither of the above help.
>>
>>
>> On Thu, Nov 19, 2009 at 12:04 PM, laredotornado <la...@gmail.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> I'm using MyFaces 1.1.6 with JBoss 5.1.  Is there somewhere that keeps a
>>> record of calling a particular validator method for a component?  I'm
>>> asking
>>> because I have this code ...
>>>
>>>                                <h:selectOneMenu
>>> validator="#{domeTour.validateValueNotEmpty}"
>>> styleClass="hourMenu" id="domeTourTime1"
>>> value="#{domeTour.prefs[0].time}">
>>>                                <f:selectItems
>>> value="#{domeTour.timePrefItems}"/>
>>>                                </h:selectOneMenu>
>>>
>>> with this backing bean validator code ...
>>>
>>>        public void validateValueNotEmpty(FacesContext context,
>>> UIComponent
>>> component, Object value)
>>>                throws ValidatorException {
>>>                String clientId = component.getClientId(context);
>>>                LOGGER.info("calling special validator method for " +
>>> clientId);
>>>
>>>  TourRequiredIfCheckedValidator.doRequiredIfCheckedLogic(context,
>>> clientId,
>>> value);
>>>        }       // validate
>>>
>>> but the log statement never shows up in my log, leading me to believe the
>>> validator method is never being invoked.  I'm looking for a more formal
>>> way
>>> to prove that.
>>>
>>> Thanks for your help, - Dave
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Does-the-validation-life-cycle-get-logged-anywhere--tp26421394p26421394.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Does-the-validation-life-cycle-get-logged-anywhere--tp26421394p26444611.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Does the validation life cycle get logged anywhere?

Posted by laredotornado <la...@gmail.com>.
Is it true that if you have a custom validator set up for the input, but you
leave the input field empty, your validator will not get invoked?

Also, where does this line

org.apache.myfaces.lifecycle.LifecycleImpl = trace

go?  Thanks, - Dave



Mike Kienenberger wrote:
> 
> This is for 1.2, but it's probably the same.
> 
> org.apache.myfaces.lifecycle.LifecycleImpl = trace
> 
> will log the lifecycle.  Seems like this should really be debug level.
> 
> Most of the time it's a lifecycle issue rather than a validation issue.
> 
> Sometimes making sure you have a message/messages component is
> sufficient to identify the problem.
> 
> I don't see any logging for UIInput, but you can set a breakpoint at
> processValidators() if neither of the above help.
> 
> 
> On Thu, Nov 19, 2009 at 12:04 PM, laredotornado <la...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I'm using MyFaces 1.1.6 with JBoss 5.1.  Is there somewhere that keeps a
>> record of calling a particular validator method for a component?  I'm
>> asking
>> because I have this code ...
>>
>>                                <h:selectOneMenu
>> validator="#{domeTour.validateValueNotEmpty}"
>> styleClass="hourMenu" id="domeTourTime1"
>> value="#{domeTour.prefs[0].time}">
>>                                <f:selectItems
>> value="#{domeTour.timePrefItems}"/>
>>                                </h:selectOneMenu>
>>
>> with this backing bean validator code ...
>>
>>        public void validateValueNotEmpty(FacesContext context,
>> UIComponent
>> component, Object value)
>>                throws ValidatorException {
>>                String clientId = component.getClientId(context);
>>                LOGGER.info("calling special validator method for " +
>> clientId);
>>              
>>  TourRequiredIfCheckedValidator.doRequiredIfCheckedLogic(context,
>> clientId,
>> value);
>>        }       // validate
>>
>> but the log statement never shows up in my log, leading me to believe the
>> validator method is never being invoked.  I'm looking for a more formal
>> way
>> to prove that.
>>
>> Thanks for your help, - Dave
>> --
>> View this message in context:
>> http://old.nabble.com/Does-the-validation-life-cycle-get-logged-anywhere--tp26421394p26421394.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Does-the-validation-life-cycle-get-logged-anywhere--tp26421394p26444611.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Does the validation life cycle get logged anywhere?

Posted by Mike Kienenberger <mk...@gmail.com>.
This is for 1.2, but it's probably the same.

org.apache.myfaces.lifecycle.LifecycleImpl = trace

will log the lifecycle.  Seems like this should really be debug level.

Most of the time it's a lifecycle issue rather than a validation issue.

Sometimes making sure you have a message/messages component is
sufficient to identify the problem.

I don't see any logging for UIInput, but you can set a breakpoint at
processValidators() if neither of the above help.


On Thu, Nov 19, 2009 at 12:04 PM, laredotornado <la...@gmail.com> wrote:
>
> Hi,
>
> I'm using MyFaces 1.1.6 with JBoss 5.1.  Is there somewhere that keeps a
> record of calling a particular validator method for a component?  I'm asking
> because I have this code ...
>
>                                <h:selectOneMenu validator="#{domeTour.validateValueNotEmpty}"
> styleClass="hourMenu" id="domeTourTime1" value="#{domeTour.prefs[0].time}">
>                                <f:selectItems value="#{domeTour.timePrefItems}"/>
>                                </h:selectOneMenu>
>
> with this backing bean validator code ...
>
>        public void validateValueNotEmpty(FacesContext context, UIComponent
> component, Object value)
>                throws ValidatorException {
>                String clientId = component.getClientId(context);
>                LOGGER.info("calling special validator method for " + clientId);
>                TourRequiredIfCheckedValidator.doRequiredIfCheckedLogic(context, clientId,
> value);
>        }       // validate
>
> but the log statement never shows up in my log, leading me to believe the
> validator method is never being invoked.  I'm looking for a more formal way
> to prove that.
>
> Thanks for your help, - Dave
> --
> View this message in context: http://old.nabble.com/Does-the-validation-life-cycle-get-logged-anywhere--tp26421394p26421394.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>