webtier@glassfish.java.net

Re: [webtier] Problem with f:validateRegex - Bug?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 02 Dec 2009 09:50:23 -0800

You may want to look at using varStatus and its index property:

http://java.sun.com/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/index.html

On 11/30/09 8:17 AM, webtier_at_javadesktop.org wrote:
> Hi,
> I try to generate a formular with JSF 2.01 and I want to use the regex validator for my input. The regex changes according to a value in the bean. But I can't realize it in JSF... I tried the following code:
> <ui:repeat value="#{GrammarBean.indexOfInputs}" var="indexOfInputs">
> <h:inputText id="input" label="#{GrammarBean.namesOfInputs[indexOfInputs]}"
> value="#{GrammarBean.inputs[indexOfInputs]}" required="true">
> <f:validateRegex pattern="#{GrammarBean.regEx[indexOfInputs]}" />
> </h:inputText>
> <h:message for="input" styleClass="errorMessage" /><br/>
> </ui:repeat>
>
> But this generates the ErrorMessage "Regex pattern must be set to non-empty value."
>
> everything workes fine if I changed<f:validateRegex pattern="#{GrammarBean.regEx[indexOfInputs]}" /> to<f:validateRegex pattern="#{GrammarBean.regEx[0]}" />. But this should be the same for my example. I already checked that indexOfInputs is 0 and #{GrammarBean.regEx[indexOfInputs]} is "[a-z]*". This must be a bug in the JSF API.
> [Message sent by forum member 'lorion42' ]
>
> http://forums.java.net/jive/thread.jspa?messageID=373861
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>