I want to validate the inputs to my JSF page inside my Managed bean, but for some reason it does not work?
@ManagedBean
@RequestScoped
public class RegistrationController {
//values passed from the JSF page
private String ...
|
I want to validate a field to be able to accept values only between 1 and 100. It works fine, but when i write a something that is not an integer ... |
I created a simple input field for an int variable. I want to add validation to it but, but i see no need to create my own validator for it, since ... |
My validator needs to know if it is a full request or an ajax request. In my current solution I check the http request header for the X-Requested-With element:
public void validate(FacesContext ...
|
|
|
|
|
|
|
|
Yes, there is. Assuming that your standard language in English, which would be contained in (say) "MyMessages.properties", you can simply add another file called "MyMessages_fr.properties", and it would automagically be used if the Locale is French. Same for "MyMessages_it.properties" etc. You can even have different versions for the same language, e.g. MyMessages_en_US.properties and MyMessages_en_GB.properties if you need to differentiate between American ... |
|
|
|
|
Not sure, but it doesn't look like the Validator interface is actually implemented. How is it compiling? In your case with method calls I don't think you need to actually implement the Validator interface, but the validation methods should have methods with the same signature as the validate method in the Validate interface. The validateDate method doesn't look quite right, I ... |
|
|
Hi, I have the following case: Here is my code in the scope of a tag I want to customize my validation error message to accept parameters. Something like "signup_username_required={0} is too long" where {0} to be changed with the username invalid ... |
Hi, as you have required = true for your InputText that means you are using jsf inbuilt validation so it first validating through that only as it is failing the condition of required = true it is throwing validationException and aborting the next validations for that component. if you provide some text in that field then your custom validator will get ... |
|
|
Hi. I have a custom component which accepts a date input. And I want to support multiple date formats - DD/MM/YY; DD/MON/YY; DD/MON/YYYY; DD.MM.YYYY; DD.MM.YY and so on. You get the idea right? (MON indicates the first three letters of the name of the month). But I was getting an error : '01-04-2010' could not be understood as a date. when ... |
Your question is not very clear for me, but you should try a custom validator where you can define your own message. public classMSISDNValidator implements Validator { @In(value="#{editPartner.smsNumbers}", required=true) private List smsNumbers; @In(value="#{editPartner.smsPhoneNumber}", required=false) private SmsPhoneNumber smsPhoneNumber; public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String inputMSISDN = (String) value; List list = new LinkedList(smsNumbers); list.remove(smsPhoneNumber); for (SmsPhoneNumber ... |
|
I don't understand the value of dynamically adding a validator myself. Unless you're HEAVILY into dynamic View construction, it's generally easier to just define the thing statically in faces-config.xml. Your error message would appear to indicate that things were mostly done correctly, except that you didn't include the file /WEB-INF/classes/my/company/MyCustomValidator.class in your WAR. Or its equivalent. |
|
When i submit the page i need to do Validation for more than 1 field i have written custom validation class My question is can i do validation for multiple fields in the same Custom Validation class i Tried and it's not working in My Custom Validation class when i try to find the component for which i need to do ... |
|
|