Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Typically you use a custom scope when you want your beans to live longer than the original request but shorter than the session. Based on your scenario though, it seems to me that your custom scope is behaving slightly like a request scope. Anyway, maybe I'm not understanding your scenario fully but one thing that comes to mind is that you can use system events in case a user decides to go to the next page when they type the address directly. So suppose the user tries to go to <code>nextPage.xhtml</code>, it could be defined like this </p> <pre><code>&lt;f:event type="preRenderView" listener="#{bean.performPossibleCustomScopeCleanUp}" /&gt; &lt;h:head&gt; &lt;/head&gt; </code></pre> <p>The (pseudo) method above will fire before the view root (aka <code>nextPage.xhtml</code>) is rendered. Inside the method you can check to see if your custom scope is still "alive" and you will handle it as needed. Keep in mind though that this event will be fired every time the page is requested. For instance, if you click the <code>h:commandLink</code> <code>performPossibleCustomScopeCleanUp</code> will still be invoked. There are ways around that </p> <p><a href="https://stackoverflow.com/questions/6377798/what-can-fmetadata-and-fviewparam-be-used-for">What can &lt;f:metadata&gt;, &lt;f:viewParam&gt; and &lt;f:viewAction&gt; be used for?</a></p> <p>Just scroll down to the section <strong>Performing business action on GET parameters</strong> of the answer</p> <p>An even better approach would be to implement a custom <code>NavigationHandler</code> through JSF's <code>ConfigurableNavigationHandler</code> API so you can keep track of the URL and perform actions as needed. I didn't dig too dig so you might actually find a better <a href="http://www.ninthavenue.com.au/blog/an-alternative-jsf-navigation-handler" rel="nofollow noreferrer">code sample</a>. Hope this helps. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload