I have a problem with JSF commandLink inside a datatable. I can not get it to work.
My bean is in a request scope, my action class is also in a request scope. Here is my datatable:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html">
<ui:include src="../blocks/head.xhtml"/>
<body>
<ui:include src="../blocks/header.xhtml"/>
<div class="content_table" align="center">
<h:dataTable headerClass="data_table_header"
cellpadding="10"
rowClasses="dataTableRow1,dataTableRow2"
value="#{searchBean.searchResult.corpusInfos}"
var="corpusInfo">
<h:column>
<f:facet name="header">
#{msg['application.corpusInfoTable.corpusPart']}
</f:facet>
#{corpusInfo.corpusPart}
</h:column>
<h:column>
<f:facet name="header">
#{msg['application.corpusInfoTable.totalWords']}
</f:facet>
#{corpusInfo.allWordsCount}
</h:column>
<h:column>
<f:facet name="header">
#{msg['application.corpusInfoTable.request']}
</f:facet>
<h:form id="idSimpleSearchForm">
<h:commandLink id="idSimpleSearchFromTable" action="#{searchAction.processSearch}"
value="#{corpusInfo.searchTerm}">
<f:setPropertyActionListener value="50" target="#{searchBean.lineLength}"/>
<f:setPropertyActionListener value="simpleSearch" target="#{searchBean.searchType}"/>
<f:ajax execute="@form"/>
</h:commandLink>
</h:form>
</h:column>
<h:column>
<f:facet name="header">
#{msg['application.corpusInfoTable.usageNumber']}
</f:facet>
#{corpusInfo.usageCount}
</h:column>
<h:column>
<f:facet name="header">
#{msg['application.corpusInfoTable.analyzedSourcesCount']}
</f:facet>
#{corpusInfo.analyzedSourcesCount}
</h:column>
</h:dataTable>
</div>
<ui:include src="../blocks/footer.xhtml"/>
</body>
</f:view>
</HTML>
I have tried to change the scope of action class and bean to session or view. No success. The page just refreshes when I click the generated link.
This table gets generated from my previous request. First page contains some fields and action button, when action button is click action class is reached the needed data is set to bean class and passed to the following xhtml page where this datatable is. I see all values at the table in the right order, it is all ok except the action link.
Any ideas on how to solve this?
EDITED:
I put all page in which data table is. Maybe there is something wrong with other tags? Maybe they changes the view? Navigation to this page is written in faces-config.xml file like this:
<navigation-rule>
<navigation-case>
<from-action>#{searchAction.processSearch}</from-action>
<from-outcome>success_simple_search</from-outcome>
<to-view-id>/views/concordance/concordance.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{searchAction.processSearch}</from-action>
<from-outcome>failure</from-outcome>
<to-view-id>/views/error/unexpectedError.xhtml</to-view-id>
</navigation-case>
</navigation-rule>