I have a JSF/RichFaces setup with an index.jsp
which a4j:include
s another piece of code which contains a rich:dataTable
.
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:include
d. My updated tabPanel appears.
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
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.
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>
.
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.
Thanks
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:include
d.
Also note the <%@ taglib uri=...
references have been removed from both files.
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
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?
I often experience this when I reRender commandButtons/Links.
Your a4j:form is in effect reRendering itself. Try changing it to something like this:
UPDATE: move your h:form to enclose the a4j:include. Pretty sure that it needs a form and of course you can't nest forms.
The fix was to install a facelets jar. See here.