Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF 2 : How to make browser back button not to used cache pages and make a kind of refresh/redirection?
    primarykey
    data
    text
    <p>I use JSF 2.2 &amp; prettyfaces. I want to prevent security problems linked to browser backward functionality.</p> <p>To resume the navigation link between my pages in my application : I have a login page done with Spring Security which redirects after connexion to a HomePage. The HomePage is in ViewScoped. From this HomePage , i can go to a AddPatientPage in ViewScoped and a AddAnalysePage in SessionScoped.</p> <p>When the user is on the AddP*Page, if he clicks the browser backward button, i don't want to use cached page. I want a kind of redirection/ refresh of the page. I want the Homepage to use the initial values as it was a first load.</p> <p>I'm trying to apply this <a href="https://stackoverflow.com/questions/10305718/avoid-back-button-on-jsf-web-application?lq=1">solution</a> without success... For example, when i get back to the HomePage from Add*Page, the values from the SelectOneMenu are not the initial ones, but the last selectioned. So i believe the cash is still use... Before to test , i cleared the cache files from browser.</p> <p>Thanks for the help.</p> <p>As BalusC in previous Post, i don't use annotation but directly referencing the filter in web.xml as above.</p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;noCacheFilter&lt;/filter-name&gt; &lt;filter-class&gt;com.clb.genomic.lyon.servletFilter.NoCacheFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;noCacheFilter&lt;/filter-name&gt; &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt; &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt; &lt;/filter-mapping&gt; </code></pre> <p><strong>* EDIT :*</strong> </p> <p>Using different words ,the problem is that when i use the backward button the values of the page components are not the same that its backing bean. So i don't understand which are kept tracked and which ones are not in the scope.</p> <p><strong>* EDIT2 :*</strong> </p> <p>Ok , i let down the ajax call. The idea of the ajax call was that when you select a value in SelectOneMenu from a first form , you then inject the result to and other form with a second another SelectOneMenu and a commandButton to send all the values together. That was a mess to handle with backward button compatibility. So now i put the two selectOneMenu, in an unique form without ajax and it's working well...no problem with backward button and synchronisation between beans &amp; page values of SelectOneMenu...</p> <p>I hope someone have understand what was i trying to do :)</p>
    singulars
    1. This table or related slice is empty.
    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. COYou're using a `@ViewScoped` bean to manage the page, however that kind of beans are deleted when a JSF navigation step is performed (means returning not null or empty String from an action method). However, Spring security doesn't work like that as it has its own POST method, so you can't ensure it's deleted when you access the application. I suggest you two workarounds: make it request scoped in order to make the managed bean stateless or make it session scoped and be sure to clear all the data when user logs in the app.
      singulars
    2. COI'm not sure the problem come from Spring Security.(In fact maybe...) Just to be clear, the system connexion works well. Each time I Log In , I'm redirect to HomePage and the values of some selection menus are good. It doesn't keep track of old action. The problem comes after when i navigate from Home to another page and try to go back to Home by backward button. But yes there is a Spring Security Filter , i need to investigate this a little more. But I can't change my HomePageScope because of ajax calls i'm doing on it..so i'm stucked
      singulars
    3. COSo it's working if i used SessionScoped, i keeps the values from the beans & page synchronous. Cool , but the problem is that on my page, i request database in @PostConstruct annoted function to show some data. When i add some participant with the addparticipant page, the data is no more refresh on homePage because of the session scoped.(i need to log out to see the added data) It's was working with ViewScoped, but i have this problems with backward navigation and selectOneMenu init with ajax stuffs
      singulars
 

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