validation and action problem

[nobr]Hello,

i've got a little problem.

i developed a test-application with page where you can fill in an e-mail address.

<h:form>

<h:inputText id="email" value="#{selberValidierenBean.email}" required="true" maxlength="50">

<f:validator validatorId="MailValidator"/>

</h:inputText>

<h:message for="email"/>

<br/>

<h:commandButton value="Senden" action="#{selberValidierenBean.etwasTun}" />

</h:form>

so far.

if the user types in a wrong value a message appears.

now the problem:

scenario: user types 5 times a wrong, the sixth time a right email

this means:

the action will be executed 6 times.

My question: Why, and how can i avert this?

Thanks for helping ;-)

Message was edited by:

alex-ger[/nobr]

[1060 byte] By [alex-gera] at [2007-11-27 11:59:20]
# 1

> scenario: user types 5 times a wrong, the sixth time

> a right email

>

> this means:

> the action will be executed 6 times.

This is actually not true. The action method should not be invoked when the validation fails. If it happens somehow, then there might be something wrong in your validator. Is the MailValidator being executed anyway and does it throw a ValidatorException when the validation fails?

BalusCa at 2007-7-29 19:24:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...