1
votes

I was recently developing an XPage that had an inputText control using a viewScope as the value. Below is the initial XPage name being used:

xpNewOrderFax.xsp

and this shows the viewScope values:

viewScope values listed for xpNewOrderFax.xsp

now when I switch to this Xpage:

xpRequest.xsp

the viewScope value for AccessNumber is not listed as expected:

viewScope values listed for xpRequest.xsp

So, now you would think that since the viewScope value for the AccessNumber has been removed from the viewScope map that if I return to the xpNewOrderFax.xsp page I would have to re-type my value. However, that is not what occurs. The viewScope value is listed once again as shown:

viewScope value for AccessNumber is listed

My question is whether this is an issue or by design because it was my understanding that a viewScope is available until you leave the current XPage. I have been able to get a co-worker to replicate this issue where the viewScope value disappears when leaving the current XPage and re-appearing when returning to the XPage. In the XPages Portable Command Guide on pg 213 it sounds like this is by design, but then on pg 215 it sounds like it is an issue. There is no value set for the application or session timeout settings on the XPage properties page.

Hopefully, someone can clarify this not only for me, but the many others using this research outlet.

Update at request of Per: This is the code for the inputText control and I did a search to be sure I wasn't doing a viewScope.put("AccessNumber") or a viewScope.get("AccessNumber") anywhere else.

ccDuplicate Access Number

I didn't use the browser Back button when discovering this. I am using an outline entry, code below, to navigate from one page to the other, then a tab in the OneUI layout, property settings below, to navigate back.

ccOutline_AdminOneUI Layout

1
Show us the code that sets the viewScope variable. Is the viewScope variable bound to a control and not set elsewhere on the XPage?Per Henrik Lausten
I believe the viewscope is cached. It is only cleared when the view (XPage) is a new document context or you load 3-4 other views after that. Check that book for maxviews re: persistence.Simon O'Doherty
Are you sure that the viewScope is cached? I can reproduce the scenario only by using the browser's back button: the first page will then be served from the browser's cache. Also, the viewScope seems to be cleared if you use (for instance) a button with an 'Open Page' action. (oh: and +1 for using my debug toolbar :-)Mark Leusink
Don't have the books on hand. But what was described you can see it changing behavior after loading a 3-4th view, the first in disappears.Simon O'Doherty
thought you would appreciate that MarkDwain Wuerfel

1 Answers

1
votes

I think Mark's comment is likely on the right track: if you go back in the browser and continue using the older page, you'll probably pick back up on the older page instance. The viewScope is tied to a combination of the page name (e.g. "/xpNewOrderFax.xsp") and the $$viewid value (e.g. "!dsk58bqeqm!"), and so the viewScope lives on the server for a little while after the user leaves the page, since the server doesn't know if the user is going to come back to it. If you visit another page and then go back in the browser to the previous one, it could resurrect the sleeping ID-keyed instance of the page and pick back up where it was, viewScope and all.

I suppose the same could also happen if you're in an environment where the initial page load is overly cached and it doesn't even re-fetch a new instance from the server on a new GET, but that would be a network/proxy/browser problem more than something with Domino.