struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jouravlev <>
Subject Re: Validation Question how to echo back users input in error message?
Date Fri, 04 Nov 2005 18:01:03 GMT
I would like to know the answer on this too. I searched the Net, all
examples use properties from property file. Using resource="false"
does not help with either (neither?) of these variants:

<arg0 key="nestedUser.fromAddress" resource="false"/>
<arg0 key="${nestedUser.fromAddress}" resource="false"/>
<arg0 key="registrationForm.nestedUser.fromAddress" resource="false"/>
<arg0 key="${registrationForm.nestedUser.fromAddress}" resource="false"/>

where registrationForm is action form definition in struts-config.xml,
nestedUser is a nested BO. Originating mail address is rendered in
HTML and submitted back to application as "nestedUser.fromAddress".

Commons Validator does not process HttpServletRequest (that is
expected). I glanced at ValidatorForm from Struts Validator
integration, and saw this validate() method:

public ActionErrors validate(ActionMapping mapping,
                             HttpServletRequest request) {

  ServletContext application = getServlet().getServletContext();
  ActionErrors errors = new ActionErrors();

  String validationKey = getValidationKey(mapping, request);

  Validator validator = Resources.initValidator(validationKey,
    this, application, request, errors, page);

  try {
    validatorResults = validator.validate();
  } catch (ValidatorException e) {
    log.error(e.getMessage(), e);

  return errors;

So, maybe you want to debug this one.

Commons Validator basically does not have documentation, only
Javadocs, which is not very descriptive. No comments in the source,
either. This is frustrating.


On 11/4/05, Troy Bull <> wrote:
> I am using the struts validator and it works almost exactly the way I want.
> Say I have a field tf and the value is "ABC"
> I want to do a validation requiring it to be an integer and return the
> following error message: "tf must be an integer".
> I can do all this pretty easily here is the code that does it:
> in :
> validation.error.acty.integer={0} must be an integer and "{1}" is not.
> in validations.xml
>   <field property="acty" depends="integer">
>     <msg name="integer" key="validation.error.acty.integer"/>
>     <arg0 key="ACTY" resource="false"/>
>     <arg1 key="${??????}" resource="false"/>
>   </field>
> my question is what do I put in ?????? to get hte actual value the user
> entered to be echoed back out
> so if I type in AAA into the acty field I want the error message to be:
> ACTY must be an integer and "AAA" is not.
> Thanks Troy

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

View raw message