struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nitin pericherla (JIRA)" <>
Subject [jira] [Created] (WW-4940) Corrupted error message with getText
Date Wed, 30 May 2018 19:24:00 GMT
nitin pericherla created WW-4940:

             Summary: Corrupted error message with getText
                 Key: WW-4940
             Project: Struts 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.3.34
            Reporter: nitin pericherla


The dev team is running into an issue randomly in Strut2 validation, the broken getText()
function is diplayed in error messages as shown below and this happens randomly , it depends
on number of error messages and sequence the way the error is displayed , we found that by
formating the XML in certain way would reduce these instances but randomly another error message
will turn to "getText" So far we have not found the best way to avoid these.

, please check below for this issue



During our migration from struts 1 to struts 2, we had to migrate STRUTS XML Validation from
struts1 to struts 2 validation as it has changed, Although there are other ways but we used
getText function to get the desired results so we do not have to change how our error messages
getting displayed. Basically using the application resource file for getting column labels
and error message text.


*Validation Error:- You must correct the following error(s) before proceeding:* 
 * Error Message 1.
 * Error Message 2.
 * Error Message 3.
 * *$\{getText("sample.col.samplefi*
 * Error Message 4.



*O**riginal struts 1 XML validation is migrated to struts 2 in this following way*

<field property="sampleField" depends="required">

          <arg0 key="sample.col.samplefield1" />


<field property="sampleField2" depends="validwhen">

          <arg0 key="sample.col.samplefield2" />




                   <![CDATA[ (((*this* == null) and (sampleField == 'somevalue'))
or (*this* != null))]]>





*Struts 2 XML Validation snippet*

          <field name=" sampleField1">

                   <field-validator type="requiredstring">

                             <param name="trim">true</param>




          <field name=" sampleField2">

                   <field-validator type="fieldexpression">

                             <param name="expression">

         <![CDATA[ (((sampleField2.trim().equals("")) && (sampleField1.equals("N")))
|| (!sampleField2.trim().equals(""))) ]]></param>







This message was sent by Atlassian JIRA

View raw message