You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinicius Caldeira Carvalho <vi...@squadra.com.br> on 2004/12/28 14:17:05 UTC
Validator what am I missing??
Hi there. I can't get validator to work (although I've done this before)
I know I'm missing something.
Here's my configuration files:
struts-config:
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in>
validation.xml
<formset>
<form name="cadastrarHistoricoNegociacaoForm">
<field property="outras" depends="required">
<arg0 key="historicoNegociacao.campo.outras"/>
</field>
<field property="areaAtuacao" depends="required">
<arg0 key="historicoNegociacao.campo.atuacao"/>
</field>
</form>
</formset>
I have the original validator-rules.xml and the appResources has all the
default messages.
My form, extends ValidatorForm, and I have a validate method with this body:
ActionErrors errors = super.validate(mapping,request);
if(errors == null){
errors = new ActionErrors();
}
if(produtos.size() == 0){
errors.add("produto",new
ActionMessage("historicoNegociacao.erro.produtos"));
}
Problem is, the call to the super class always return an empty (not
null) ActionErrors. What could be wrong?
thanx
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Validator what am I missing??
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Vinicius,
What are you using as your struts-config.xml form-bean and action mapping?
A lot of people get the ValidatorForm and ValidatorActionForm reversed in
their minds/thinking. Your mappings for those two related items should
assist us in determining if that is the issue.
Regards,
David
-----Original Message-----
From: Vinicius Caldeira Carvalho
[mailto:vinicius.carvalho@squadra.com.br]
Sent: Tuesday, December 28, 2004 8:17 AM
To: Struts Users Mailing List
Subject: Validator what am I missing??
Hi there. I can't get validator to work (although I've done this before)
I know I'm missing something.
Here's my configuration files:
struts-config:
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in>
validation.xml
<formset>
<form name="cadastrarHistoricoNegociacaoForm">
<field property="outras" depends="required">
<arg0 key="historicoNegociacao.campo.outras"/>
</field>
<field property="areaAtuacao" depends="required">
<arg0 key="historicoNegociacao.campo.atuacao"/>
</field>
</form>
</formset>
I have the original validator-rules.xml and the appResources has all the
default messages.
My form, extends ValidatorForm, and I have a validate method with this body:
ActionErrors errors = super.validate(mapping,request);
if(errors == null){
errors = new ActionErrors();
}
if(produtos.size() == 0){
errors.add("produto",new
ActionMessage("historicoNegociacao.erro.produtos"));
}
Problem is, the call to the super class always return an empty (not
null) ActionErrors. What could be wrong?
thanx
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org