Conversion errors are added to the list of field errors by the
"conversionError" interceptor.
Personally, I almost always remove the "conversionError" as the
conversion error messages aren't necessarily helpful, and are sometimes
redundant--your mileage may vary.
But that's why you get both messages.
Dave
Robert Stenholt Mygind wrote:
Hi All
I have some problems with field validation in Struts2, I am not the
most experienced in Struts2.
</SNIP>
I have a form looking something like this:
<s:form action="calcprices" method="post">
<s:textfield name="subscriptions" label="Some tekst:"/>
..
<s:submit name="submit" value="Calc"></s:submit>
</s:form>
</SNIP>
In my acrion class I have something looking like:
<SNIP>
@RequiredFieldValidator(message = "Some error text", shortCircuit=true)
public Integer getSubscriptions() {
return subscriptions;
}
</SNIP>
The field is a Integer field, so if I insted write "test" in it I get
the following HTML:
<SNIP>
<div id="wwerr_calcprices_subscriptions" class="wwerr">
<div errorFor="calcprices_subscriptions" class="errorMessage">
Invalid field value for field "subscriptions".
</div>
<div errorFor="calcprices_subscriptions" class="errorMessage">
Some error text
</div>
</div>
</SNIP>
The first is the default from "invalid.fieldvalue" and the second is
the one I made.. I only wish to have the secound, in some kind of
override. I also tried to use
@ConversionErrorFieldValidator(message = "Default message")
@RequiredFieldValidator(message = "Some error text", shortCircuit=true)
and that is the same, get both errors..
I don't have any idea what to do, maybe I have misunderstood the
Struts2 validation completely. Hope you can help.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org