4

I have recently picked up Wicket and built a single page web application with multiple tabs. I have used AjaxTabbedPanel and each tab pretty much contains all Ajax input components. The issue is when I leave the application idle for a minute (or few seconds less in fact) and click on other tab, the application does not honor my request until I click again second time. Once I click the second time, the application comes to normal functioning in terms of tab navigation. Is this something to do with Wicket model getting detached and a fresh model being created? Can somebody advise me any way to fix this so I can navigate the tabs without being constrained by any time limit.

UPDATED

I can see the same issue on the wicket example page. Please check the link below. If you firstly select "second tab" and leave the page idle for at least a couple of minutes and then if you click "third tab", it either stays on "second tab" or goes to "first tab". If you click again on the "third tab", then it will work but again until it goes idle after sometime. You will see the same problem over and over again whenever the page goes idle.

examples6x.wicket.apache.org/ajax/tabbed-panel

Nishat Lakhani
  • 733
  • 1
  • 8
  • 20
IndoKnight
  • 1,846
  • 1
  • 21
  • 29
  • What's the answer (http) if you click the tab the first time? Can you see anything strange in the ajax debug window? The model shouldn't be freshly generated though ... It either loads it from some external source (database?) or just deserializes it from the pageMap. – Thorsten Wendelmuth Sep 14 '16 at 16:16
  • Please see my updated description, thanks. – IndoKnight Sep 19 '16 at 08:52
  • Well on the example page from wicket I would assume that the session times out within 5 minutes (I get a new session if the tab reloads) Therefore wicket can no longer know the state of the Page. What's your session timeout? Can you check if you get a new session in your application as well? – Thorsten Wendelmuth Sep 19 '16 at 13:18
  • The session timeout in web.xml is set to 60mins. So, I believe this is unlikely causing the issue. – IndoKnight Sep 19 '16 at 13:28
  • Hmmm I couldn't reproduce that behavior with the example running it locally. Not sure how much of help I can be. What kind of environment are you running (wicket version, container, etc) I assume your logs don't state anything about not being able to serialize or something similar? – Thorsten Wendelmuth Sep 19 '16 at 15:30
  • Well, I have seen the issue coming for other people working with me. If you can leave the page for say 5 mins after clicking "second tab" and try again you should be able to notice. The Wicket version I am using is 6.1 and the container is Glassfish 3. These should not really matter as the issue is quite obvious from the Wicket examples website. – IndoKnight Sep 20 '16 at 10:45
  • 2
    As I said before the wicket examples behavior can be explained by the session timeout of 5 minutes (if the session is gone, wicket will need to reload everything and has no longer access to the Model-values). I just confirmed that they use the 5 minute timeout by checking out their github web.xml: https://github.com/apache/wicket/blob/master/wicket-examples/src/main/webapp/WEB-INF/web.xml#L917 – Thorsten Wendelmuth Sep 20 '16 at 14:40
  • Thanks for that link. I am working on some application where my session timeout was set to 60min but it is apparent that the timeout was happening sooner may be because of programmatic override on the session timeout but that was obscured in one of the encoded jars in lib directory without my knowing. I will investigate more on this, thanks again. – IndoKnight Sep 20 '16 at 15:26
  • 3
    If you can reproduce the problem easily I would suggest debugging by using the Session.onInvalidate() method. – Thorsten Wendelmuth Sep 20 '16 at 20:30

1 Answers1

1

I never used it, but if the problem is just about idle time and there is no way to ignore that by changing configuration, don't allow it to go to the idle mode. try to simulate current tab click. Call this function inside onload. it will search all selected tabs and click on them each 10 seconds. it doesn't matter how many tab panels do you have. it search all of them:

setInterval(function() {

    var qsa = document.querySelectorAll('li.select'), length = qsa.length;
    for (var i=0;i<length;i++){
        var fchild = qsa[i].firstChild;
        if (fchild && fchild.tagName=='A'){
            fchild.click();
        }
    }

},10000);
ICE
  • 1,667
  • 2
  • 21
  • 43
  • This may fix the problem but I was looking more to try and understand how the issue is being caused and fix it accordingly. – IndoKnight Sep 26 '16 at 11:55