0
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
    <h:head>
        <title>Community</title>

    </h:head>
    <h:body>

        <rich:panel>
            <f:facet name="header">
                <h:outputText value="Login form" />
            </f:facet>
            <h:form id="loginform">
                <h:panelGrid columns="2" width="210">
                    <rich:validator  id="loginformvalidate">                
                        <h:outputText value="Username:" />
                        <h:inputText label="username" id="username" value="#{loginMB.username}" required="true" requiredMessage="user name is requried">
                            <f:validateLength minimum="5" />
                        </h:inputText>                    

                        <h:outputText value="Password" />
                        <h:inputSecret label="password" id="password" value="#{loginMB.password}" requiredMessage="password is requried">
                            <f:validateLength minimum="8" maximum="16" />
                        </h:inputSecret>

                    </rich:validator>

                    <rich:notifyMessages  stayTime="2000" nonblocking="true"  />

                    <f:facet name="footer">
                        <a4j:commandButton value="Login"/>
                    </f:facet>
                </h:panelGrid>
            </h:form>

        </rich:panel>
        <rich:panel>
                    <h:form id="Questions">
                        <rich:dataTable value="#{contentBean.questions}" var="list" id="question" >
                            <rich:column>#{list.QUserid.fname}</rich:column><br/>
                            <rich:column> <rich:collapsiblePanel expanded="false" header="#{list.questionValue}" switchType="client" onclick="#{contentBean.onclick(list.qid)}" >
                                    <rich:accordion id="answer" switchType="ajax">
                                        <a4j:repeat value="#{contentBean.ansList}" var="skinName" >
                                            <rich:accordionItem name="#{skinName.ansDate}">
                                                #{skinName.ansValue}

                                            </rich:accordionItem>
                                        </a4j:repeat>
                                    </rich:accordion></rich:collapsiblePanel></rich:column>
                            <br/><rich:column>
                                  <h:commandButton value="Show popup">
                                            <rich:componentControl target="popup" operation="show">
                                                    <a4j:param noEscape="true" value="event" />
                                                    <rich:hashParam>
                                                            <f:param name="width" value="500" />
                                                            <f:param name="height" value="300" />
                                                            <f:param name="minWidth" value="300" />
                                                            <f:param name="minHeight" value="150" />
                                                            <a4j:param noEscape="true" name="left" value="(jQuery(window).width()/2)-250" />
                                                            <a4j:param noEscape="true" name="top" value="(jQuery(window).height()/2)-150" />
                                                        </rich:hashParam>
                                                </rich:componentControl>

                                        </h:commandButton>
                                 <rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false">
                                    <f:facet name="header">
                                        <h:outputText value="Add your answer" />
                                    </f:facet>
                                    <p>Enter your answer in less than 4000 char</p>

                                    <p>
                                        <h:inputTextarea id="answertxt" value="#{contentBean.ansvalue}" required="true"  requiredMessage="this feild is required"/>
                                        <h:commandButton value="Submit" onclick="#{rich:component('popup')}.hide(); return false;">
                                            <a4j:actionListener  for="Submit"  listener="#{contentBean.addAnswer(list.QUserid,list.QGroupid, list)}"/>

                                        </h:commandButton>


                                    </p>
                                </rich:popupPanel>
                            </rich:column>
                        </rich:dataTable>
                    </h:form>
        </rich:panel>


    </h:body>
</html>

我是 jsf 和 richfaces 的新手,我想创建两个不同形式的单曲面板,我可以这样做吗?该页面一直有效,直到我在弹出窗口中添加了使用动作侦听器的新按钮

我收到以下错误

INFO: WEB0671: Loading application [My_community] at [/My_community]
INFO: My_community was successfully deployed in 19,911 milliseconds.
SEVERE: /index.xhtml @21,61 id="loginformvalidate" Unhandled by MetaTagHandler for type org.richfaces.component.behavior.ClientValidatorImpl

页面运行但弹出生成的动作监听器上的提交按钮不起作用如果我做错了什么请告诉我

4

1 回答 1

1

你确定,rich:validator 可以生孩子吗?我认为它应该在您要验证的字段内:

<h:inputText label="username" id="username" value="#{loginMB.username}" required="true" requiredMessage="user name is requried">
    <f:validateLength minimum="5" />
    <rich:validator/>
</h:inputText>
于 2013-03-22T08:32:09.223 回答