Dave, Thanks for the suggestion, I changed the validator to read as:
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER) @JoinColumn(name = "STATUS") @FieldExpressionValidator(message = "Default message", key="validate.status", expression = "status != null") public Status getStatus() { return status; } The validation is applied, but no message is displayed. With: @ExpressionValidator(message = "Default message", key="validate.status", expression = "status != null") The validation is applied and the validation message appears at the top of my page where I have an <s:actionerrors /> tag. Is there something else I need to do to make the FieldExpressionValidator work? MG -----Original Message----- From: Dave Newton [mailto:newton.d...@yahoo.com] Sent: Tuesday, March 17, 2009 6:01 PM To: Struts Users Mailing List Subject: Re: Required field only works with text fields? Griffith, Michael * wrote: > The following validation annotation seems to work: > > @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, > fetch=FetchType.EAGER) > @JoinColumn(name = "STATUS") > @ExpressionValidator(message = "Default message", > key="validate.status", expression = "status != null" ) public Status > getStatus() { > return status; > } > > However, the validation message appears in <s:actionerror /> block, > not nicely next to the field that failed validation as does the other > validators. You'd probably need a @FieldExpressionValidator in order for it to be associated with a field, but this is just a guess. > I might have expected this if I had specified shortCircut=true, but I > don't. I'm not really sure what the shortCircuit flag is supposed to do. IIRC its intent is to prevent multiple validation errors for the same field. Dave --------------------------------------------------------------------- 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