Hi all,
So i'm using appfuse 1.9.3 and struts 1.2.8 with apache tomcat 5.5.16 and
java 1.5.0_06
The question is:
Why struts validator doesn't work for the max length validator? The alert
message displays in right way (when i digit more characters then i've setted
in maxlenhth var) but in the alert box the message is: 'Autore abbreviato'
doesn't exceed 'null' chars
My getter method:
/**
* @return Returns the autoreAbbreviato.
* @hibernate.property column="AUTORE_ABBREVIATO" length="35"
* @struts.validator type="maxlength" msgkey="errors.maxlength"
* arg1value="${var:maxlength}"
* @struts.validator-var name="maxlength" value="35"
*/
public String getAutoreAbbreviato() {
return autoreAbbreviato;
}
My getter method in its form:
/**
* @struts.validator type="maxlength" msgkey="errors.maxlength"
* arg1value="${var:maxlength}"
* @struts.validator-var name="maxlength" value="35"
* @param autoreAbbreviato The autoreAbbreviato to set.
*/
public void setAutoreAbbreviato(String autoreAbbreviato) {
this.autoreAbbreviato = autoreAbbreviato;
}
And the validation.xml :
<form name="volumeDatiGeneraliForm">
<field property="autoreAbbreviato"
depends="maxlength">
<msg
name="maxlength"
key="errors.maxlength"/>
<arg0 key="volumeDatiGeneraliForm.autoreAbbreviato"/>
<arg1
name="maxlength"
key="${var:maxlength}"
resource="false"
/>
<var>
<var-name>maxlength</var-name>
<var-value>35</var-value>
</var>
</field>
And ApplicationResources.properties:
errors.maxlength='{0}' doesn't exceed {1} chars.
The syntaxt for that validator is correct, like described by struts manual:
<field property="name" depends="required,maxlength">
<arg0 key="customer.name"/>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var><var-name>maxlength</var-name><var-value>30</var-value></var>
</field>
I have also setted the required validator but the result it's the same.
The weird thing is that the validator in old appfuse release has worked for
me with tomcat 5.0.28 and java 1.4.2_06
with this configuration in validation xml:
<field property="titolo"
depends="maxlength">
<msg
name="maxlength"
key="errors.titolo"/>
<arg0 key="autoreForm.titolo"/>
<var>
<var-name>maxlength</var-name>
<var-value>16</var-value>
</var>
</field>
Any suggestion?