Re: Does prettyfaces 3.3.0 support EL2 method params for the action?

Splash Forums PrettyFaces Users Does prettyfaces 3.3.0 support EL2 method params for the action? Re: Does prettyfaces 3.3.0 support EL2 method params for the action?

#21433

Hey Pablo,

I think you actually don’t need things like arguments in EL method invocations very often when you are using PrettyFaces. What about some more RESTful URL approach? Something like this:

Link to the edit page like this. This will create a standard HTML link which will result in a simple GET request when clicked. I assume currentItem is the item you are currently rendering (in a table or something like this):

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

The URL mapping for the edit page (a URL of the format /item/23):

<url-mapping id="itemEdit">
<pattern value="/item/#{ itemController.id }" />
<view-id value="/item/edit.jsf" />
<action onPostback="false">#{ itemController.editAction }</action>
</url-mapping>

And the class used for the item edit page:

public class ItemController {

// injected by PrettyFaces
private Long id;

// loaded in action method
private Item item;

public void editAction() {
item = itemDao.getById(id);
}

/* getters and setters */

}

It loads the item using the ID from the URL. This will create a very RESTful URL that will work independently from other pages.

That’s the way I design my apps! :)

Christian