Re: CommandButton with parameters

Splash Forums PrettyFaces Users CommandButton with parameters Re: CommandButton with parameters

#21136

emon
Participant

First, thank you for your quick response. I tried pretty:link and it worked. The problem is that I need execute some actions on server before redirect. The other thing I tried was to use EL-injected path parameters instead of Named path parameters:

<url-mapping id="employeeForm">

<pattern value="/employees/#{empList.selectedAction}/#{empList.selectedId}/" />

<view-id value="/WEB-INF/pages/employees/modify.xhtml" />

<action onPostback="false">#{employeeForm.init}</action>

</url-mapping>

<h:commandButton value="Edit with h:commandButton" action="#{empList.getEditUrl}" immediate="true">

<f:setPropertyActionListener target="#{empList.selectedAction}" value="edit" />

<f:setPropertyActionListener target="#{empList.selectedId}" value="#{emp.id}" />

</h:commandButton>

and this works together with commandButton.

So I did little research and I believe that the “problem” is in ExtractedValuesURLBuilder.buildURL. If I understand it right, it uses FacesContext and evaluates EL expression form pattern. But it cannot find #{action} because there is no one. I think if evaluating of #{action} failed it should try to find #{param}. Then it should be possible to use commandButton or commandLink.

It is just my guess, I did not test it.

But maybe I complete wrong:)

Anyway PrettyFaces is great library. Thanks