struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bacco77 <>
Subject validation error
Date Tue, 22 Jul 2003 11:21:09 GMT
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:

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

My validator is:

package mypackage;

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"));
System.out.println("Wage--->" + wage);
System.out.println("Tax--->" + tax);
if (wage>=1000 && tax<1000)
System.out.println ("Erroe");
return false;


return true;


then what is the problem?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message