3 Replies Latest reply on Sep 22, 2008 5:23 AM by luxspes

    Execute arbitrary method upon specific page navigation

      I have a page (destination.xhtml) that needs to be modified programmatically depending on whether navigation came from source1.xhtml, source2.xhtml, etc. I've created the methods to do the appropriate page modification for each of these cases, but I can't tell whether Seam will allow me to use them on a navigation-specific basis. The following scenarios don't work:

      1) I can't use the action element in pages.xml for the page I mentioned, because destination.xhtml would need a different method run based on whether we were previously redirected from source1.xhtml, source2.xhtml etc.

      2) I tried to use an evaluate attribute for the navigation element in pages.xml so that I could customize navigation specific to source1, source2, etc, but that didn't work because it's looking for a property rather than a method (prepending the method name with get doesn't work, and is a workaround at best). I tried to use

      3) I then tried to use a raise-event element under navigation, but that didn't work because the observer method is called before the redirection occurs, so any programmatic modifications of the page work on source1, source2, etc and not destination.xhtml.

      How can I execute an arbitrary method for a specific page navigation? If this doesn't exist, I'd be surprised.


        • 1. Re: Execute arbitrary method upon specific page navigation

          Why can't you use destination1.xhtml from source1.xhtml, destination2.xhtml from source2.xthml, etc... and then use facelets templating <ui:composition> <ui:include> to abstract away any duplication?

          • 2. Re: Execute arbitrary method upon specific page navigation

            A few reasons that I wouldn't want to do it that way are:

            - to keep the number of artifacts to a minimum (based on the number of different navigation cases, I could be introducing tens or hundreds of destination.xhtml pages, if not more)

            - for a bookmarkable, RESTful application where the location of the page matters, I may not want to introduce multiple destination pages when it really is ONE page (with very slight modifications), just because Seam doesn't allow it to be done programmatically

            So based on your Seam knowledge, does the capability I mentioned in my original post not exist (to be able to execute an arbitrary method on page navigation)?

            • 3. Re: Execute arbitrary method upon specific page navigation

              And... did you tried with plain sending a diffent query string for each case?


              and read it with a @RequestParameter ?