Griffith, Michael * wrote:
Can anyone help me with this?

By adding the @RequiredField annotation to the relationship field
(status in my example below) the form did not submit, which is good
because the status had not been specified from the list. However, the
form did not present a message too the user saying why the form
submission failed.  I have the field annotated as:


@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
fetch=FetchType.EAGER)
@JoinColumn(name = "STATUS")
@RequiredFieldValidator(message="Validation
Error",key="validate.notEmpty")
public Status getStatus() {
        return status;
}
Any reply would be appreciated.

My first assumption would be that you'd need to have a custom validator, depending on how Status objects are initialized/created. AFAIK "required" will only check for nullness.

I'm not sure if a Status object will be created if no status properties are set, but if it is, then it probably won't work with a simple "required". If any status properties are set then it definitely won't--empty string fields aren't null; they're blank.

I'm a little surprised "required" works with your textfields, since strings normally need a "requiredstring" validator to function properly.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to