Re: URLMapping pattern vs query parameters

Splash Forums PrettyFaces Users URLMapping pattern vs query parameters Re: URLMapping pattern vs query parameters

#21209

I think Lincoln is right. If you want to use a h:commandButton you should call an action that sets the target property in your bean correctly and then redirects to your page. PrettyFaces will then be able to create the correct link for the mapping. Something like this:

<h:commandButton value="EDIT" action="#{findAccount.show}" />

public class FindAccount {

@Inject
private ManageAccount manageAccount;

public String show() {
manageAccount.setId( selectedItem.getId() );
return "pretty:manageAccount";
}

}

You could even do something similar without an action:

<h:commandButton value="EDIT" action="pretty:manageAccount">
<f:setPropertyActionListener target="#{manageAccount.id}" value="#{findAccount.selectedItem.id}" />
</h:commandButton>

But both methods will created a needless postback followed by a redirect to the correct URL. You won’t need the ugly postback if you use just a standard HTML link like this:

<pretty:link mappingId="manageAccount">
<f:param value="#{findAccount.selectedItem.id}"/>
Click me!
</pretty:link>

Hope this helps! :)

Christian