F:阿贾克斯不工作工作、阿贾克斯不

2023-09-10 15:49:00 作者:你是二逼中的战斗机

我有麻烦 F:AJAX 工作在一个 H:panelGroup中。 下面是我在做什么:

I have trouble getting f:ajax to work on a h:panelGroup. Here's what i'm doing:

JSF code:

<h:panelGroup id="contacts_tab_contacts_list_list">
    <h:form>
    <ul>
        <c:forEach items="#{currentDevice.contacts}" var="contact">
            <li>
                <f:ajax event="click" onevent="logcheck()">
                    <h:panelGroup layout="block" 
                                styleclass="contacts_tab_contacts_list_quickview_box"  >
                            <h:outputText value="#{contact.firstName} #{contact.familyName}" />
                    </h:panelGroup>
                </f:ajax> 

                <f:ajax event="click" onevent="logcheck()">
                    <f:param value="#{contact.getUUID}" name="currContactUUID" />
                    <h:commandButton value="#{contact.firstName} #{contact.familyName}" 
                    styleclass="contacts_tab_contacts_list_quickview_box" />
                </f:ajax>
            </li>
        </c:forEach>
    </ul>
    </h:form>
</h:panelGroup>

是什么样子的网页上:(忽略傻格式:-)​​)

What it looks like on the web page: (Ignore silly formatting :-) )

最后,哪些页面的源代码如下:

And finally, what the source of the page looks like:

<li>
    Name - 35 Family - 35
    <input 
        id="j_id594943238_6609edf4:j_id594943238_6609ec58" 
        name="j_id594943238_6609edf4:j_id594943238_6609ec58" 
        type="submit" 
        value="Name - 35 Family - 35" 
        onclick=".. removed .." /> 
</li> 

(请注意 H:panelGroup中被吞噬由元素。)

我可以点击 H:的commandButton 和它工作正常。 当我点击文本没有happends,这是有道理的,因为,因为它似乎从期待在源代码中的 H:panelGroup中随着 F: AJAX 消失!

I can click the h:commandButton and it works properly. Nothing happends when I click the text and it makes sense because, as it seems from looking in the source, the h:panelGroup along with the f:ajax have disappeared!

就是这样。很抱歉的长度,但我希望得到所有细节了。 感谢您的帮助: - )

That's it. Sorry for the length but I wanted to get all the details out. Thanks for the help :-)

推荐答案

我觉得panelGroup中会被吞噬,因为只有一个组件中。也许JSF优化它。

I think the panelGroup will be swallowed since there is only one component inside. Maybe jsf optimizes it.

再有就是只有 H:的outputText 离开这的 未实现部分的这是需要的,获取阿贾克斯附加的组件javax.faces.component.behavior.ClientBehaviorHolder 接口。

Then there is only the h:outputText left and this component doesn't implement the javax.faces.component.behavior.ClientBehaviorHolder interface which is required for a component that gets ajax attached.

您可以使用 H:outputLink的或者 H:。outputLabel 而不是