I have the following problem

I've implemented a Dynamic form with validation (required,mask etc..)

The standard validation works correctly.

Then i wrote my own validator.
The validator works but when he send me to the form after the error occurs,
an exception occurs in my page:

"Cannot find bean error in any scope."

The jsp page:

<logic:messagesPresent>
   <bean:message key="errors.header"/>
   <ul>
   <html:messages id="error">
      <li><bean:write name="error"/></li>
   </html:messages>
   </ul><hr>
</logic:messagesPresent>


My validator is:

package mypackage;

import java.io.Serializable;
import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;

import org.apache.commons.validator.*;
import org.apache.struts.util.*;


public class MyOwnValidator implements Serializable 
{
  public MyOwnValidator()
  {
  }

  public boolean validateTwoFields (Object bean,ValidatorAction va, Field 
field,ActionErrors errors, HttpServletRequest request  )
  {

    int wage=0;
    int tax=0;


  
    tax=  Integer.parseInt(ValidatorUtil.getValueAsString(bean,field.getProperty()));
    wage=  
Integer.parseInt(ValidatorUtil.getValueAsString(bean,field.getVarValue("secondProp")));
    System.out.println("Wage--->" + field.getVarValue("secondProp"));
    //wage=Integer.parseInt(field.getVarValue("secondProp"));
    System.out.println("Wage--->" + wage);
    System.out.println("Tax--->" + tax);
    if (wage>=1000 && tax<1000)
    {
      System.out.println ("Erroe");
      errors.add(field.getKey(),StrutsValidatorUtil.getActionError(request,va,field));
      return false;
    
    }

    return true;
    
    
  }
}

then what is the problem?





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to