(Suggestion) Parameterised view action

Splash Forums PrettyFaces Users (Suggestion) Parameterised view action

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18497

    Egor Kolesnikov
    Participant

    Hi,

    Surprisingly, under-documented things like this work fine in prettyfaces-3.3.2 (as included by seam-faces-3.1.0.Final), effectively rendering dreadful jsf2 f:metadata tag completely useless (as it, in my humble opinion, should have always been):

    <url-mapping id="modify-page">
    <pattern value="/console/website/page/modify/#{pageId}" />
    <view-id value="/console/website/page-modify.xhtml" />
    <action>#{pageMaintainAction.prepareModify(pageId)}</action>
    </url-mapping>

    This approach would leave, I believe, cleaner action code since it is no longer necessary to declare pageId as well as its getter and setter in managed bean.

    Unfortunately, but completely understandably, this will not work if prepareModify() method declares pageId parameter as anything else rather than java.lang.String. I could provide a patch that would do automated conversion from String to standard java types including Integer, Long, BigDecimal, Date, etc.

    Just before I start working on that, I would like to confirm no one’s already busy doing that.

    Many thanks,

    Egor.

    #22768

    Hi Egor,

    very interesting approach. I never thought about doing it this way. Nice catch. :)

    But you are right. The fact that this works only for strings isn’t very userfriendly. But actually I’m a bit surprised that it doesn’t work for other primitive types like int, long, etc. Because this works fine for path parameters directly injected into beans.

    However there is currently no more active development done for PrettyFaces 3.x because we are working hard on PrettyFaces 4.0, which will be based on OcpSoft Rewrite and has been rewritten from the scratch. So if you are interested in this feature, you could maybe take a look at Rewrite and test if it works there like expected. And if it does, I see no reason why it should work in PrettyFaces 4.0. :)

    Rewrite

    Best regards

    Christian

    #22769

    Egor Kolesnikov
    Participant

    Ah, I see. Ok, I will give Rewrite a try later in the week. Would appreciate it if you could update the documentation as well. We’ve been doing this kind of thing with Seam2 *.page.xml files for quite a while and really missed the feature in Seam3/JSF2. Up until we discovered PrettyFaces, though.

    #22770

    Sure. Feel free to tell us what you think about Rewrite. :)

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

You must be logged in to reply to this topic.

Comments are closed.