struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Gary VanMatre)
Subject Re: Shale Validation Framework Issue.
Date Mon, 10 Jul 2006 17:13:05 GMT
Please take future Shale discussions to the shale mailing list.

>----- Original Message ----- 
>From: "Iakouchev Alexander-EAL027C" <>
>To: <>
>Sent: Monday, July 10, 2006 8:56 AM
>Subject: Shale Validation Framework Issue.

>Hello everybody!
>I am a new in Shale Validation Framework. Actually I got an error after
>form was submitted.
>My Tomahawk version - 1.1.3.
>[http-80-Processor24] WARN
>org.apache.commons.validator.ValidatorResources - Form
>'org.apache.shale.validator.minStringValue' not found for locale 'en_US'
>2006-07-10 10:00:08,784 [http-80-Processor24] ERROR
>StandardWrapper[/RPTCServicesManagement:Faces Servlet] -
>Servlet.service() for servlet Faces Servlet threw exception


>That is wrong with my code?
>Seems, information from custom-rules.xml file loaded properly, but it
>is looks like minFloatValue method can not findound.

> > INFO: Loading validation rules file from /WEB-INF/custom-rules.xml
> > 2006-07-07 13:52:16,714 [http-80-Processor24] WARN
> > org.apache.myfaces.renderkit .html.util.ReducedHTMLParser - !
> > tag found: unexpected input while looking


>2. /WEB-INF/custom-rules.xml

You need to add the formset/form for your custom validation rule.  The form 
is used to define the message key parameters and the parameters used when 
calling the validation method.

<validator name="minStringValue" 
       method="isMinStringValue" methodParams="java.lang.String" 
      <form name="org.apache.shale.validator.minStringValue">
          <field property="required">
              <arg position="0" name="message" key="arg" resource="false"/>
              <arg position="1" name="message" key="submittedValue" 

              <arg position="0" name="parameter" key="submittedValue" 

              <arg position="1" name="parameter" key="minLength" 

The "message" args above define the parameters for the MessageFormat class. 
If you have a message like "{0} is invalid.  The value {1} is not long 
enough.", the first parameter would be the commons validators arg value and 
the second the submitted value of the component.

The "parameter" args define the values for the method signature of the 
target validation rule.  I add the second "minLength" parameter above to 
show how you might want to make the length a variable.

public static boolean isMinStringValue(String value1, int minLength)

You define this "formset/form" definition once per custom validation rule 
and then override it at the component level versus each html form.  For 
example, if you wanted to change the validation message you could override 
that at the component level.

<s:commonsValidator  type="minStringValue" server="true" client="false" 
arg="Last Name"/>


<s:commonsValidator  type="minStringValue" server="true" client="false" />
    <s:validatorVar name="arg" value="Last Name"/>
    <s:validatorVar name="minLength" value="10"/>

>I will be appreciating for any feed back.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message