IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only

custom validator not working !!

  • 1.  custom validator not working !!

    Posted Wed September 16, 2009 09:18 PM

    I used the following code inside the pagebeanView.java for the custom validator, to compare two dates, but the validator doesn’t work when I click the submit button, but when I click the submit button next time, it works. I changed the page bean scope from session to request, but still the problem persits. I don’t know the reason for this weird behavior. Can you please check this code and suggest me if I am going wrong somewhere?

    Thanks
    Venu

    public void dateInput_validator(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value) {
    // TODO: Check the value parameter here, and if not valid, do something like this:
    //throw new ValidatorException(new FacesMessage(“Not a valid value!”));
    DateInput test =(DateInput)this.findComponentInRoot(“defaultForm:dateInput1”);
    DateInput effdt =(DateInput)this.findComponentInRoot(“defaultForm:dateInput”);
    java.util.Date exprdte = (java.util.Date)test.getValue();
    java.util.Date effdte = (java.util.Date)effdt.getValue();
    if(exprdte!=null && effdte!=null){

    		if(exprdte.before(effdte)){
    
    throw new ValidatorException(new FacesMessage("Not XXXX!"));
    }
    }
    

    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine