Note that there are some explanatory texts on larger screens.

plurals
  1. POPreRenderView skipping button action after browser back
    primarykey
    data
    text
    <p>I have a search result page with a "Show more results" button. The backing bean is session-scoped and we use a preRenderView to execute the search method in the backing bean:</p> <pre><code>&lt;f:event type="preRenderView" listener="#{SearchBean.searchSolutions}" /&gt; </code></pre> <p>The "Show more results" button is defined like this:</p> <pre><code>&lt;h:commandButton action="#{SearchBean.onClickShowMoreResults()}"&gt; &lt;f:ajax disabled="false" render=":searchResultsForm"/&gt; &lt;/h:commandButton&gt; </code></pre> <p>Here is the problem I have and the steps to reproduce :</p> <ol> <li>Execute a search. </li> <li>Click on a search result that leads to a result page.</li> <li>Use the browser back button.</li> <li>Click on the "Show more results" button.</li> <li>Problem --> the onClickShowMoreResults() function is not called and the searchSolutions() listener method is called instead (this happens intermittently, most of the time the function is called correctly and everything is alright altought once I get the problem I can reproduce it every time with steps 2 to 4 without starting a new search).</li> </ol> <p>I tried skipping the ajax requests in the listener method (as explained <a href="https://stackoverflow.com/questions/14687910/how-to-avoid-prerenderview-method-call-in-ajax-request">here</a>) and it solves the problem, but this is not possible for me because there are ajax requests that need to execute the listener method (changing search criteras).</p> <p>Is there something I don't understand about the preRenderView or is there another way to achieve what I am trying to do ?</p> <p>Thanks for the help!</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.
 

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