You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Suresh (JIRA)" <ji...@apache.org> on 2018/02/01 13:49:00 UTC

[jira] [Commented] (VALIDATOR-436) apache common validation is displaying only passed args like {0} in spring 3.2.0

    [ https://issues.apache.org/jira/browse/VALIDATOR-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16348597#comment-16348597 ] 

Suresh commented on VALIDATOR-436:
----------------------------------

It's urgent. plz help me.

> apache common validation is displaying only passed args like {0} in spring 3.2.0
> --------------------------------------------------------------------------------
>
>                 Key: VALIDATOR-436
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-436
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 1.1.4 Release
>            Reporter: Suresh
>            Priority: Critical
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> My project previously deployed on Websphere7 with spring 1.2 and apache common validator 1.1.4. The validation was working fine.
>  
> Now as per the requirement change we have migrated the project to JBOSS eap 6.4 with spring 3.2.0 and apache common validator 1.1.4. Now the validation is not working as expected.
>  
> Issue: 
> we have employer group id field with required validation. when we try submitting the form without entering the value for the field it should show "Please enter value for Employer Group ID". But it's displaying only "Employer Group ID".
>  
> Please find below code:
>  
> Jsp page:
> ----------
> <%@ taglib prefix="core" uri="http://java.sun.com/jstl/core" %>
>  <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
>  <%@ taglib prefix="str" uri="http://jakarta.apache.org/taglibs/string-1.0.1" 
>  %>
>  <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
>  
>  <%@ taglib uri="http://jakarta.apache.org/taglibs/i18n-1.0" prefix="i18n" %>
>  <i18n:bundle baseName="jspresources.xxx-label" localeRef="userLocale"/>
>  
>  <tr>
>  <spring:bind path="createForm.empNumber">
>  <td class="message" align="left" colspan="2">
>  <strong><core:out value="${status.errorMessage}" /></strong></td> 
>  </spring:bind>
>  </tr>
>  
>  
> Validation.xml:
> --------------
>  
>  <form name="createForm">
>  <field property="empNumber" 
>  depends="mask,alphaNumeric,required,minlength,maxlength">
>  <arg0 key="createForm.empNumber"/>
>  <msg name="required" key="errors.required"/>
>  <arg1 name="minlength" key="${var:minlength}" resource="false"/>
>  <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
>  <msg name="alphaNumeric" key="errors.alphanum"/>
>  <msg name="mask" key="errors.invalid"/> 
>  <var><var-name>mask</var-name><var-value>^[^(0|\ )+][a-zA-Z0-9]*$</var-
>  value></var> 
>  <var>
>  <var-name>minlength</var-name>
>  <var-value>1</var-value>
>  </var>
>  <var>
>  <var-name>maxlength</var-name>
>  <var-value>9</var-value>
>  </var>
>  </field>
>  </form>
>  
> validator-rules.xml:
> ---------------------
>  <validator name="required" classname="PropertyChecks" 
>  method="validateRequired" methodParams="java.lang.Object, 
>  org.apache.commons.validator.ValidatorAction,org.apache.commons.
>  validator.Field, 
>  org.springframework.validation.Errors,org.apache.commons.validator.
>  Validator" msg="errors.required"/>
>  
>  
> ApplicationResources.properties:
> ---------------------------------
>  
>  createForm.empNumber=Employer Group Id
>  errors.required=Please enter \{0}.
>  
> applicationContext.xml:
> -----------------------
>  
>  <beans>
>  
>  <bean id="messageSource" 
>  class="org.springframework.context.support.ResourceBundleMessageSource">
>  <property name="basename">
>  <value>messages</value>
>  </property>
>  </bean>
>  <bean id="validatorUtil"
>  class="UtilFormValidator" init-method="init" singleton="true">
>  <property name="resources">
>  <list>
>  <value>validator-rules.xml</value>
>  <value>validation.xml</value>
>  </list>
>  </property>
>  <property name="messageResourceFile">
>  <value>ApplicationResources</value>
>  </property>
>  </bean>
>  
>  </beans>



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)