我有一个带有index.jsp
的JSF / RichFaces设置a4j:include
另一段包含rich:dataTable
的代码。
它最初呈现正常,并在index.jsp
的dropDown列表中选择一个项目并点击'Retrieve'a4j:commandButton
使用支持bean的setChosen
方法对其进行出价后端。辅助bean更新类成员,然后由单独的文件content.jsp
a4j:include
中的模型读取元素调用其getter。我的更新tabPanel出现了。
我可以在eclipse控制台中看到输出。但当我再次按下按钮时,没有任何反应。 tomcat 6.0日志中没有任何内容,控制台上没有任何内容。
EDIT1
将问题缩小到我的content.jsp
文件,而不是上面的index.jsp
代码,我发现问题是rich:dataTable
元素。当我从content.jsp
中删除此元素时,我可以一遍又一遍地重新点击“检索”按钮,然后重新加载我的选项卡面板。一旦我把它插入,第一次点击就可以了,然后按钮会点击,但没有任何反应,按钮也不会取消。
为rich:dataTable
提供数据的方法不应该是可疑的,因为它至少第一次起作用,但它只执行一些xpath例程并返回ArrayList<MyDataList>
。
鉴于编辑,任何人现在都可以建议如何使用rich:dataTable
,以免它造成任何麻烦?该元素位于rich:tabPanel
内,位于h:form
内,但这就是全部。
由于
EDIT2 :
在回复下面的评论请求时,以下是完整的受影响代码列表,其中简要说明将重现该问题。 @Damo,请注意a4j:commandButton
和rich:dataTable
位于不同的文件中,因为后者位于jsp文件a4j:include
d中。
另请注意,<%@ taglib uri=...
引用已从两个文件中删除。
的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>
非常感谢您对此的看法。
EDIT3
根据要求,我已尝试将a4j:include
封装在h:form
中。为了使包含的内容避免嵌套h:表单,我将h:form
中的封闭content.jsp
标记替换为h:panelGrid
。
当我重申这一点时,第二次单击a4j:commandButton
仍然导致挂起,但我检查了萤火虫并发生了POST http://localhost:8888/index.jsf 200 13ms
,但响应为空。这有帮助吗?
答案 0 :(得分:4)
你的a4j:表格实际上是重新生成的。尝试将其更改为以下内容:
<a4j:form>
<a4j:outputPanel id="panel">
<h:outputText style="text-align: center" value="Select " />
<h:selectOneMenu id="mySelect" value="#{MyBacking.chosen}">
<f:selectItems value="#{MyBacking.myList}" />
</h:selectOneMenu>
</a4j:outputPanel>
<a4j:commandButton value="Retrieve" reRender="panel"/>
</a4j:form>
更新:移动你的h:表格以包含a4j:include。很确定它需要一个表格,当然你不能嵌套表格。
答案 1 :(得分:0)
修复是安装facelets jar。请参阅here。