Friday, 15 April 2011

jsf - Add a default validator to my custom UIComponent -


I am developing a custom JSF UIInput that expects a specially designed value from the user. In order to validate user input, I need to run a chain of check which is only related to the application in hand. This is not just a normal email or phonenumber input field, it is a text input that has the overall value that needs to be deformed in parts and each part has to be validated.

I have been able to make myself a component. @SpaceComponent ("MyComponent") public class MyComponent UIInput {public String getFamily ()) extends {...} encodeBegin () {...} encodeEnd () {. ..}}

mycomponent.taglib.xml is bundled inside Meta-INF and I use the component successfully I can do

I also have a valid class which works all it is ready.

  Public class Automation DetectionWidator Applicable Legalization {Public throws value valid (...) Valuer applicants {...}}   

However, I need it To include a custom legalization for this component as the default, I can do it manually as follows:

  & lt; Custom: myComponent & gt; & Lt; F: Validator validator id = myaComponentValidator ??? / / Gt; & Lt; / Custom: myComponent & gt;   

but expected usage will be

  & lt; Custom: myComponent / & gt;   

and the verifier should be there automatically.

I've been googling all day now but I can find the basic examples of that do not want to use.

Just add component to the creator.

  Public MyComponent () {AddValidator (New Automation Distributor ()); }    

No comments:

Post a Comment