You may have a different problem then you think; The @RequiredFieldValidator does not make any sense on a int (primitive) field as an int cannot be null. The validation interceptor checks the values on the fields after params interceptor sets the fields. The RequiredFieldValidator checks if the field is null which will never be the case for a primitive field.
On Fri, Dec 4, 2009 at 5:25 AM, Per Johansson <perj...@gmail.com> wrote: > Hi, > > I'm trying to get error messages from a resource bundle. > > This is the code for my action class: > > @RequiredFieldValidator(type=ValidatorType.FIELD, > key="myFieldErrorMsg", message="Error!!!!") > public void setMyField(int myField) { > this.myField = myField; > } > > @Override > public void validate() { > if (!isMyFieldValid(myField)) { > addFieldError("myField", getText("myFieldErrorMsg")); > } > } > > When validation fails for setMyField I don't get the expected error > message from my resource bundle. > Instead I get a struts default error message "Invalid field value for field > ..." > > But when i call getText from the validate method, I get the expected > error message. > > How can I get a message from a resource bundle using the annotation > based validator? > I'm using weblogic 10.0. > > > /Best regards, Per Johansson > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org