I'm using JSF and making a webapp. I succeeded to assign a value to a variable in normal xhtml page, but not in a page where i have a datatable of primefaces. Biding doesnt work so search has to be null. Here is my code.
<p:dataTable id="examplej" class="table couple-table"
var="info" value="#{bb.coupleList}" rows="10" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" paginator="true" emptyMessage="お探しの地域では見つかりませんでした">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="地域で検索" />
<br/> <br/>
<p:inputText id="search" value="#{bb.search}" style="width:150px" p:placeholder="例:世田谷区"/>
<h:commandLink type="submit" value="地域で検索" action="#{bb.filterTable}" class="Button"/>
</p:outputPanel>
</f:facet>
<p:ajax event="rowSelect" listener="#{bb.detail(info)}"
/>
//left out
</p:dataTable>
search is null in this method.
public String filterTable() {
System.out.println("filterTable()");
System.out.println("search in filterTable() = " + search);
Flash flash = FacesContext.getCurrentInstance()
.getExternalContext().getFlash();
flash.put("search", search);
System.out.println("search in filterTable in Bb = " + search);
return "filtered-table.xhtml";
}
Thank you in advance.