Reputation: 2575
View:
<h:form>
<p:dataTable var="job" value="#{controller.jobs}">
<p:column>
<h:commandButton value="Start" action="#{controller.start(job)}">
<f:param name="jobName" value="#{job.name}"/>
</h:commandButton>
</p:dataTable>
</h:form>
Bean:
public String start(Job job){
return "/viewDetails?faces-redirect=true";
}
I am using @ViewScoped
for my backing bean controller.
My problem is when I click start button, it doesn't append the param jobName with value #{job.name}
to my url. Is there any way I can make it append?
Upvotes: 0
Views: 480
Reputation: 1108537
It's because you didn't specify it in the redirect URL.
return "/viewDetails?faces-redirect=true";
If you specify it in the redirect URL, then it'll — obviously — appear in the URL.
String jobNameParam = URLEncoder.encode(job.getName(), "UTF-8"); // Or ISO-8859-1, depending on server config.
return "/viewDetails?jobName=" + jobNameParam + "&faces-redirect=true";
Upvotes: 4