2 Replies Latest reply: Feb 2, 2012 7:41 AM by Brent Harlow RSS

    Target Unreachable after using back button. Internal server error

    Brent Harlow
      Dear JHeadstart team,

      We have been getting lots of user errors where the user has inadvertently used the browser back button only to be shown a nasty Error 500 - Internal Server Error

      Obviously if we could electrocute the users each time they pressed the back button to encourage them to stop doing it, this would be ideal, but failing this I was wondering if you could help with a solution/workaround.

      I've been able to replicate this with a simple test case using the HR schema (I will email test case to idevcoe_nl@oracle.com). In our application we do not use the standard JHeadstart Home.jspx page (our Home page is instead generated as the first module with the application so we redirect users to the home page by simply using UIShell.jspx). I've replicated this by adding 3 groups - Departments, Employees and Countires. Eeach of these groups are simple table-form groups, non editable tables, editable forms with a hyperlink between the table and the form. We use the JhsTreeMenuPageTemplate as the page template.

      If you change the default run target of the view controller to XXXX\ViewController\public_html\pages\UIShell.jspx this then takes the user straight to the Department table on successful login (custom authentication and custom authorization used).

      Then follow these steps : (I'm sure other combinations work as well but I've been able to consistently reproduce the error using these steps)
      1. Click on the countries menu, countries table shown
      2. Select a country to view the form
      3. Click on the breadcrumb to be returned to the countries table
      4. Click on the employees menu, employees table shown
      5. Select an employee to view the form
      6. Use the back button of the browser
      7. The browser will pop up a message asking to confirm that the form is resubmitted
      8. Agree to resubmit the form

      The following message is then displayed
      javax.el.PropertyNotFoundException: Target Unreachable, 'DepartmentsTable' returned null
           at com.sun.el.parser.AstValue.getTarget(AstValue.java:88)
           at com.sun.el.parser.AstValue.setValue(AstValue.java:133)
           at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:255)
              ...........
      Help ! How can I at the very least provide a more graceful error message (or redirect) - or preferably avoid this problem altogether. I assume the problem here is that the DepartmentsTable bean has been removed from the session ?

      Cheers,
      Brent
        • 1. Re: Target Unreachable after using back button. Internal server error
          Steven Davelaar-Oracle
          Brent,

          The browser back button always remains a problem in transactionl web apps, with or without ADF, with or without JHeadstart.

          I dont have a definitive for you but if you google for
          "adf browser back button" or
          "disble browser back button"

          You see various techniques to minimize the problem.

          I typically recommend my customers to open the adf app in a new window using javascript code in an index page, that windows doesnt have a back button.

          Steven Davelaar,
          JHeadstart team.
          • 2. Re: Target Unreachable after using back button. Internal server error
            Brent Harlow
            Hi Steven,

            I've tried a couple of approaches - one that works reasonably well - using the "org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS" param in the web.xml as detailed in Andrejus' blog here ...

            http://andrejusb.blogspot.com/2011/11/clientstatemaxtokens-1-for-browser-back.html

            Trouble with that is that the error message is not really correct - it says that the session is inactive when it's not - but, at least it avoids 500 Server Errors.

            I looked into launching a new window using javascript - created a quick html index page like (had to surround the onclick attribute with * otherwise it didn't print)
            <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
                <title>index</title>
            </head>
            <body>
            <a href="faces/XXXXXXX/pages/UIShell.jspx" target="_blank" on *onclick*="window.open(this.href, this.target, 'fullscreen=yes,status=yes,resizable=yes,toolbar=no,menubar=no');  return false;">
            Click here to launch the application</a>
            </body>
            </html>
            which worked great on Firefox and Chrome, but trouble is that in IE9 there is a setting in the tab options - that either allows IE to decide how to open a new window, or forces a new window, or forces a new tab (this seems to be default). With this setting in place, the window.open function will not open a new window - instead just a new tab, which of course means that you cannot hide the toolbar :(

            Be interested to know if you've heard any feedback on how this solution can work for IE9 (regardless of users' tab settings) - I imagine it's impossible becuase it's always going to override what the browser code requests but you never know !

            I've put a question to the weblogic forum asking for advice on whether the standard weblogic inactivity message can be changed (surely it's stored as a parameter somewhere !)

            Thanks for your advice.

            Cheers,
            Brent