Note that there are some explanatory texts on larger screens.

plurals
  1. POMy jsp page is showing the last view after writing the URL directly
    primarykey
    data
    text
    <p>I'm using JSF 1.2 for developing a small page that requires the user to login. User may have one of three roles, and I should validate if a given user has access to a page given his role.</p> <p>Let's say an admin is the only one that can access the Transactions Report. In the ViewTransactionReportBean default constructor I'm validating this:</p> <pre><code>HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); LoginBean lb = null; try { lb = (LoginBean)session.getAttribute("loginBean"); char role = lb.getRole(); if(role!='A') //Throw an exception to invalidate access }//catch here both invalid user or null pointer (not logged in) exceptions </code></pre> <p>This bean is request scope, so it should load with every Http request I make right?</p> <p>Let's test this scenario: I login as an admin. I click on the View Transaction Report page. I can see the report. I click Home. I click Log out (with logic): </p> <pre><code>public String logOut() {session.invalidate(); return "success";} </code></pre> <p>After I logout (and I'm back to login page), I directly access ../faces/viewTransactionReport.jsp by entering the URL in my browser. Instead of showing an error message, I get to see the whole report, in exactly the last state I left it before I clicked Home (before logout). It is until I refresh the page (F5) that I get the error message saying that I'm not logged in or I don't have permissions.</p> <p>After I tried debugging, when I entered the URL directly in my browser, I noticed that not even the bean constructor was called.</p> <p>But I have no idea why.</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. 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