a4j:included rich:dataTable对a4j:commandButton有负面影响 [英] a4j:included rich:dataTable negatively affects a4j:commandButton

查看:79
本文介绍了a4j:included rich:dataTable对a4j:commandButton有负面影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有index.jsp的JSF/RichFaces设置,其中a4j:include是另一段包含rich:dataTable的代码.

I have a JSF/RichFaces setup with an index.jsp which a4j:includes another piece of code which contains a rich:dataTable.

它最初呈现良好,然后在index.jsp的下拉列表中选择一个项目,然后单击检索".a4j:commandButton使用支持bean的setChosen方法在后端进行出价.支持Bean更新其类的getter然后由模型读取元素在单独的文件content.jsp(c1)d中调用.出现我更新的tabPanel.

It initially renders fine, and selecting an item on the index.jsp's dropDown list and clicking the 'Retrieve' a4j:commandButton uses the backing bean's setChosen method to do it's bidding on the back end. The backing bean updates class members whose getters are then called by the model reading elements in a separate file content.jsp which is a4j:included. My updated tabPanel appears.

我可以在eclipse控制台中看到输出.但是当我再次按下按钮时,什么也没发生.在tomcat 6.0日志中什么也没有,在控制台上什么也没有.

I can see output in the eclipse console. But when I hit the button again, nothing happens. Nothing in the tomcat 6.0 log and nothing on the console.

EDIT1 将问题缩小到我的content.jsp文件而不是上面的index.jsp代码,我发现问题是rich:dataTable元素.当我从content.jsp中仅删除此元素时,可以反复单击检索"按钮,它会重新加载我的选项卡面板.一放进去,第一次单击就可以了,然后该按钮将单击,但是什么也没有发生,并且该按钮也不会取消单击.

EDIT1 Narrowing the problem down to my content.jsp file and not the above index.jsp code, I've found that a rich:dataTable element is the problem. When I remove just this element from the content.jsp, I can reclick on the Retrieve button over and over and it reloads my tab panel. As soon as I put it in, the first click is ok, and then the button will click, but nothing occurs and the button doesn't unclick back out.

rich:dataTable提供数据的方法应该至少在第一次使用时就不会令人怀疑,但它仅执行某些xpath例程并返回ArrayList<MyDataList>.

The method that provides the rich:dataTable with data shouldn't be suspicious as it works at least the first time, but it only performs some xpath routines and returns a ArrayList<MyDataList>.

给出编辑后,现在任何人都可以建议如何使用rich:dataTable以便不会引起任何麻烦吗?元素位于rich:tabPanel内,而h:form内仅此而已.

Given the edit, can anyone now suggest how to use rich:dataTable so that it doesn't cause any trouble? The element is inside a rich:tabPanel which is inside an h:form but that is all.

谢谢

EDIT2 : 为响应下面的评论请求,以下是受影响的完整代码清单,其简短程度将重现该问题. @Damo,请注意a4j:commandButtonrich:dataTable在不同的文件中,因为后者在a4j:include d的jsp文件中. 另请注意,<%@ taglib uri=...引用已从两个文件中删除.

EDIT2: In response to a commented request below, the following is the full affected code listing as brief as will reproduce the problem. @Damo, please note the a4j:commandButton and rich:dataTable are in different files as the latter is in the jsp file which is a4j:included. Also note the <%@ taglib uri=... references have been removed from both files.

index.jsp:

index.jsp:

<f:loadBundle basename="messages" var="msg" />

<f:view>
    <rich:page pageTitle="MyTitle" markupType="xhtml">
    <h:outputText id="setup" value="#{MyBacking.setup}" />
        <rich:toolBar height="35" itemSeparator="line">
            <rich:toolBarGroup location="left">
                <a4j:form>
                    <a4j:outputPanel id="panel">
                        <h:outputText style="text-align: center" value="Select " />
                        <h:selectOneMenu id="nodes" value="#{MyBacking.chosen}">
                            <f:selectItems value="#{MyBacking.nodes}" />
                        </h:selectOneMenu>
                        <a4j:commandButton value="Retrieve"
                            reRender="panel,contentPanel,currNode,lastOp"
                            onclick="this.disabled=true" oncomplete="this.disabled=false" />
                    </a4j:outputPanel>
                </a4j:form>
            </rich:toolBarGroup>
        </rich:toolBar>

        <rich:panel>
            <h:panelGroup layout="block" id="contentPanel">
                <a4j:include viewId="#{MyBacking.viewId}">
                    <f:param name="targetIdParam" value="content" />
                </a4j:include>
            </h:panelGroup>
        </rich:panel>
    </rich:page>
</f:view>

a4j:include d content.jsp:

<h:form id="myConfig">
    <rich:tabPanel switchType="client" rendered="true">
        <rich:tab styleClass="tab" label="Connections">
            <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                cellpadding="0" cellspacing="0" width="100%" border="0" var="item"
                value="#{MyBacking.DataList}">
                <rich:column style="text-align:center" width="150px">
                    <h:outputText styleClass="txtBold"
                        value="#{item.info}:#{item.other}" />
                </rich:column>
            </rich:dataTable>
        </rich:tab>
    </rich:tabPanel>
</h:form>

非常感谢您关注这一点.

Thanks very much indeed for looking at this.

EDIT3 根据要求,我尝试将a4j:include封装在h:form中.为了使包含的内容避免嵌套h:form,我用h:panelGrid替换了content.jsp中的h:form标记. 当我重新运行此命令时,第二次单击a4j:commandButton仍然导致挂起,但是我检查了萤火虫,并出现了POST http://localhost:8888/index.jsf 200 13ms,但响应为空.这有帮助吗?

EDIT3 As requested, I've tried encapsulating the a4j:include within an h:form. In order for the included content to avoid nesting an h:form, I replaced the enclosing h:form tag in content.jsp with an h:panelGrid. When I reran this the second click on the a4j:commandButton still caused a hang, but I checked with firebug and a POST http://localhost:8888/index.jsf 200 13ms occurred but the response was empty. Does this help?

推荐答案

解决方法是安装facelets jar.请参见此处.

The fix was to install a facelets jar. See here.

这篇关于a4j:included rich:dataTable对a4j:commandButton有负面影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆