jboss - accessing request parameters from inside validator -
Is there a proper way to access other form fields from an accredited user?
context.getViewRoot (). FindComponent ("formid: exampleField: Example")?
fe I'm going to be a valid investigator checking whether the city's area and country is within a custom verifier.
Your question again and again I am going to explain it as:
"You want to write a custom legalization that checks that if a city area is present, then the area of the country is equivalent to 'US'."
First create a Vatilator interface:
@documented @ validate class (value = countryAcclasUS.L. . Class) @ Target (Elimenttaip. Tiipii) @ Riseteshn (retention policy. Aryuentiim) public @ interface Kantryaeclsss [string message () should be the country to default, "the city of the country"; }
Then create a valid category:
Public category country User OAVaider Applicant accredited & lt; CountryEqualsUS & gt; {Public Zero Start (country features arg0) {} Public boolean is invalid (object value) {if (value! = Null & value instance yourBeanClass) {YourBeanClass yourBeanClass = (YourBeanClass) value; If (/ * some test logic here * /) {return true; Other {return false; } } return false; }}
Then on the class that you want to validate:
@ countryclasses people category yourBeanClass {...}
< / Pre> Finally, at the end of your Controller / Action class, when the form is submitted, the city is a price for which you want to see the country, by calling this method Call:
public boolean taxpayer (yourbusiness class yourbie class) {classualdetter requestwalled data = new class evaluator (yourBeanCla Ss.getClass ()); Invalid value [] verification message message = request Validator.getInvalidValues (yourBeanClass); If (validation message! = Null & validation message length & gt; 0) {for (int i = 0; i & lt; verification message length; i ++) {// to show the user Add a verification message} return false; } Back true; }
Comments
Post a Comment