wood burning stoves 2.0*
The moose likes JSF and the fly likes Help creating a custom JSF component and adding a validator to it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Help creating a custom JSF component and adding a validator to it." Watch "Help creating a custom JSF component and adding a validator to it." New topic
Author

Help creating a custom JSF component and adding a validator to it.

ala alal
Greenhorn

Joined: May 18, 2009
Posts: 8
Hi all,
I would like to implement my custom component. It is basically an InputText with many other features.
I created it and all is ok but I can't add a tag <f:validator> inside cause it give me the error "Not nested in a tag of proper type."
What can I do?

Html code is that:
<myf:specialInput [...] >
<f:validator validatorId="myValidator">
</myf:specialInput>

the two class files are:
public class SpecialInputTag extends UIComponentTag (also deprecated...what I have to use??) : for the tag
public class SpecialInput extends UIPanel implements NamingContainer : for the renderer and component

Help me, thanks!

coorasse.


ala alal
Greenhorn

Joined: May 18, 2009
Posts: 8
It was three days I was trying it and now that I posted the problem I solved it.
OK OK OK.
If someone else have my problem the component you are creating must extends UIInput. I solved with that.
Bye.
ala alal
Greenhorn

Joined: May 18, 2009
Posts: 8
I have a new problem. The problem appears during the rerendering of my custom component.
It keeps some children inside and during the restore it give me an ArrayIndexOutOfBoundException.
I solved with the solution posted here: LINK that I report here:


Why I need to remove children from the tree? Why they are duplicated? Does anyone has a better solution?
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help creating a custom JSF component and adding a validator to it.