<f:validateregex>父级不是EditableValueHolder的实例:javax.faces.component.html.HtmlPanelGrid

时间:2017-09-08 08:07:15

标签: java jsf

的index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
 <title>Facelet Title</title>
</h:head>
<h:body>
    <h:form id="adres_defteri">
        <h:panelGrid columns="3">
            <h:outputText value="E-posta Adresiniz:"/>
            <h:inputText id="isim" value="#{degiskenBean.eposta}" required="true" validatorMessage="Geçersiz E-posta"  requiredMessage="E-Posta Alanı Zorunludur" />
                        <f:validateRegex pattern="^([_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{1,6}))?$"/>
            <h:message for="eposta" />
        </h:panelGrid>
        <h:commandButton value="GÖNDER" action="sonuc.xhtml" />
    </h:form>
</h:body>
</html>

错误

  

/index.xhtml @xxxxx父级不是EditableValueHolder的实例:javax.faces.component.html.HtmlPanelGrid@5790b5bb

我已经检查了类似的问题,但他们没有帮助。

IDE:NetBeans

服务器:GlassFish

1 个答案:

答案 0 :(得分:0)

试试这个:

<h:inputText id="isim" value="#{degiskenBean.eposta}" required="true" validatorMessage="Geçersiz E-posta"  requiredMessage="E-Posta Alanı Zorunludur" >
   <f:validateRegex pattern="^([_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{1,6}))?$"/>
</h:inputText>
<h:message for="eposta" />

f:validateRegex应位于h:inputText代码