JSF actions using Rewrite

Splash Forums Rewrite Users JSF actions using Rewrite

This topic contains 5 replies, has 2 voices, and was last updated by  Lincoln Baxter III 8 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #23821

    Will Durman

    Does Rewrite have way to execute JSF page-action methods, like PrettyFaces did?

    For example, can you replicate this PrettyFaces configuration:

    <url-mapping id="viewItem">
      <pattern value="/store/item/#{ iid : bean.itemId }/" />
      <view-id value="/faces/shop/item.jsf" /> 

    Update: I found the backwards compatibility module rewrite-config-prettyfaces-2.0.1.Final.jar referenced in this forum topic http://ocpsoft.org/support/topic/prettyfaces-4-0-0/. It seems to be functioning fine so far.

    I would like to eliminate xml configuration eventually. How do I achieve the same results using Rewrite rules?

    • This topic was modified 8 years, 8 months ago by  Will Durman. Reason: Clarified question

    Hi Willdurman,

    Yes! There is a way to do this using Rewrite, which is actually the core mechanism that Rewrite uses to execute PrettyFaces action methods in the compatibility module.

          return ConfigurationBuilder

    This handles both EL value injection, but also EL method invocation using the PhaseAction deferred operation handler. It should be pretty self-explanatory from here, but let me know if anything is confusing. I know it seems simple to the guy who wrote it, and that doesn’t always carry through to others!


    Will Durman

    Very good, I am using the sample code you provided to replace my PrettyFaces xml configuration.

    I have a followup question, is there a way to pass a matched portion of the URL directly to the action method? I am using JSF 2.

    I tried passing a hard-coded value like this:


    which worked just fine. I tried passing


    attempting to pass the value matched by


    but it fails.

    If not, I can create a field and getter/setter on the class which will work fine, but I’d like to understand what the problem is.

    • This reply was modified 8 years, 8 months ago by  Will Durman.
    • This reply was modified 8 years, 8 months ago by  Will Durman.

    Unfortunately, you’ll have to use a getter/setter. Rewrite doesn’t support EL parameters :(, but… if you’d like, maybe you’d want to look into adding this support? It would probably involve setting some values into the ELContext via Rewrite Parameter Bindings.

    I can point you in a few places that will help you get started, but I don’t have any bright ideas coming to mind immediately.


    Will Durman

    OK! Well I think Rewrite is really cool, and if I run into some free time I will take a look at it. It’s a bit over my head but what’s the worse that could happen?


    I doubt it’s over your head 🙂 Just a few Classes and Interfaces. Nothing special. Just have to get familiar, and we have lots of tests to help with that!

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

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

Comments are closed.