[jboss-user] [JBoss Seam] - Re: Handling database exceptions
shakenbrain
do-not-reply at jboss.com
Wed Jun 27 12:01:47 EDT 2007
Understood. Gavin, thanks for your response.
Getting back to validating then, it appears that using a @Validator class causes the session to go invalid when it throws a ValidatorException, but only on the whole form submit (it works if you do a partial form submit using ajax4jsf on just that one field, using <a:support>). Here's a validator class that does nothing but throw the exception:
@Validator
| @Name("prefixValidator")
| public class PrefixValidator extends BaseValidator {
|
| @In
| EntityManager entityManager;
|
| // @Transactional
| public void validate(FacesContext context, UIComponent component, Object value)
| throws ValidatorException {
|
| throw new ValidatorException(makeMessage("Prefix is being used already."));
|
| }
| }
and the relevent xhtml:
<s:decorate id="prefixDecorator" template="/decorateField.xhtml">
| <ui:define name="label">Prefix</ui:define>
| <h:inputText id="prefix" size="4" value="#{selectedOrganization.prefix}" required="true" disabled="#{!organizationAdmin.new}">
| <f:validator validatorId="prefixValidator"/>
| </h:inputText>
| </s:decorate>
That should work right? Is this a bug? I haven't tried this in 2.0 Beta yet, I'll try to do that today.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058280#4058280
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058280
More information about the jboss-user
mailing list