Skip to main content

[jsf2]validator attribute, composite component. Unexpected exception.

2 replies [Last post]
glich
Offline
Joined: 2009-12-22
Points: 0

have composite component
xhtml

<?xml version='1.0' encoding='UTF-8' ?>

use next method as validator
@ManagedBean
@ApplicationScoped
public class Checker {
public void validateF(FacesContext context, UIComponent component, Object value) throws ValidatorException{
throw new ValidatorException(new FacesMessage("i'm invisible"));
}
}

call component like this

but validateF generate not "i'm invisible" exception. It generate this:
/index.xhtml @37,82 validator="#{checker.validateF}": The class 'useful.Checker' does not have the property 'validateF'.

after add property validateF to Checker

public String getValidateF(){
return "";
}

and get proper exception "i'm invisible".

Is there solution to avoid adding of property?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
glich
Offline
Joined: 2009-12-22
Points: 0

I've tried this solution but still same error

used component like that:


component code:




id="input"/>

Problem is that by Validate System seek Validator message first of all in:
property 'validateF' i.e.
method-signature String getValidateMethodName()

Joel Weight

It looks like it may be similar behavior to when I was trying to pass an
actionListener.
http://forums.java.net/jive/thread.jspa?threadID=77181&tstart=30

Ed Burns
final reply here may be of interest to you
http://forums.java.net/jive/thread.jspa?threadID=79860&tstart=15

I haven't
been back to that code for a while, so I haven't validated his solution for
myself.

Joel

On Thu, May 20, 2010 at 3:52 AM, wrote:

> have composite component
> xhtml
>
>
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > xmlns:h="http://java.sun.com/jsf/html"
> xmlns:composite="http://java.sun.com/jsf/composite">
>
>
>
> > method-signature="void
> f(javax.faces.context.FacesContext, javax.faces.component.UIComponent,
> java.lang.Object)"
> targets="input"/>
>
>

>
>
>
>
>
>

>
>
>
>
> use next method as validator
> @ManagedBean
> @ApplicationScoped
> public class Checker {
> public void validateF(FacesContext context, UIComponent component,
> Object value) throws ValidatorException{
> throw new ValidatorException(new FacesMessage("i'm invisible"));
> }
> }
>
>
> call component like this
>
>
>
> but validateF generate not "i'm invisible" exception. It generate this:
> /index.xhtml @37,82 validator="#{checker.validateF}": The class
> 'useful.Checker' does not have the property 'validateF'.
>
> after add property validateF to Checker
>
> public String getValidateF(){
> return "";
> }
>
> and get proper exception "i'm invisible".
>
> Is there solution to avoid adding of property?
> [Message sent by forum member 'glich']
>
> http://forums.java.net/jive/thread.jspa?messageID=470646
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>
[att1.html]