have a datatable
<p:dataTable var="workshops" value="#{workshopBean.searchResults}" paginator="true" rows="10"
selectionMode="single" columnClasses="table_column_0x" dynamic="true" >
have a commandlink column
<p:column>
<h:commandLink type="button" action="#{workshopBean.editworkshopxhtml}">
<f:param name="workshopid" value="#{workshops.id}" />
<h:outputText value="#{primemessage.edit}" />
</h:commandLink>
</p:column>
backing bean will take the param
public String editworkshopxhtml() {
FacesContext context = FacesContext.getCurrentInstance();
Long id = Long.parseLong((String) context.getExternalContext().getRequestParameterMap().get("workshopid"));
setObjectToSession(DNAConstants.WORKSHOP_ID,id);
return "editworkshopxhtml";
}
The table is populated via a search.
Noticed that I have to redo the search at backing bean constructor in order for the commandlink to work.
Otherwise nothing happens the page remains where it is and the table is wiped.
Is this proper way of coding or am I doing something wrong, btw the backing bean is scope is request
and I do not want to make it session.
datatable and command link column with parm
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Use viewscope, it is the optimal solution for these cases.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 34 guests