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?

This topic contains 4 replies, has 3 voices, and was last updated by  Christian Kaltepoth 10 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #18035


    Hi all,

    I’m trying to use EL 2 method params with prettyfaces in order to achieve something like this:



    <h:commandButton value=”edit” action=”#{itemController.editAction(item)}” />

    Controller bean:

    public String editAction(Item item) {


    This works fine on my setup (Tomcat 6.0.32, EL2.2, PrettyFaces 3.3.0)

    But when I try to use prettyfaces is not working (the editAction method is never reached):

    <h:commandButton value=”edit” action=”pretty:itemEdit” />

    This is the config:

    <url-mapping id=”itemEdit”>

    <pattern value=”/item/” />

    <view-id value=”/item/edit.jsf” />

    <action onPostback=”false”>#{itemController.editAction(item)}</action>


    Does it makes sense or it’s not currently supported?

    Thanks in advance,



    This is not currently supported in PrettyFaces 3.x. It is already possible in PrettyFaces 4.x with a little more configuration if you are using CDI ( – but it does not look like you are?)

    Install 4.0.0-SNAPSHOT: (use version 4.0.0-SNAPSHOT)

    You will also need to add a Rewrite extensions for CDI and Faces:


    Then you need to implement a custom Rewrite provider: (PrettyFaces 4.0.0 is based on Rewrite, which is included automatically if you are using Maven – you just need to add the extensions above)

    Perform steps 3 and 4 here:

    Then you need to add your custom rule:


    I hope this helps, sorry we don’t support it in 3.x :) can only go so fast.



    Oh, I suppose if you aren’t using CDI, you could do replace the “rewrite-integration-cdi” extension with your own implementation of com.ocpsoft.rewrite.spi.ExpressionLanguageProvider

    Which requires that you find a way to access the EL-context from JSF, which can work, but might be tricky. You can look at what I’ve done for the CDI extension here:

    If you decide to do this, would you mind showing us how you did it with JSF? It shouldn’t be too hard, just not much time here at the moment :)



    Hi Lincoln,

    Thanks so mucho for the quick reply :)

    We can’t consider using rewrite until it goes GA :(

    Also, I don’t like very much having to define the navigation rule in code, some kind of XML document will be great.




    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="#{}" />
    Click me!

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

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

    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! :)


Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.