0

I am building a mobile app for iPhone using the mobile controls in the XPages Extension Library.

The first page displays a list of categories (happens to be a list of user names). When a category is selected the second page is displayed listing all documents belonging to the selected user.

The URL to open the second page includes a parameter with the user's name. The second page has a page heading control and on the "label" property I have added the following code:-

if (param.get("User") != null) {
    sessionScope.put("UserName", param.get("User"));
}
return sessionScope.UserName;

I'm doing this so that I have access to the user name on subsequent pages, e.g. the third page is displayed when the user opens a document from the list on the second page.

When I test this in Chrome everything is fine. When I test in Safari I can see that the sessionScope variable is set when the second page is opened. However, when I select a document and the third page is opened the sessionScope variable is disappearing. I can't see any code that would explain this and when tested in Chrome the sessionScope variable is still there on page 3. Unsurprisingly I get the same issue when I test on an iPhone.

The problem this gives me is that, when navigating back from a document (p.3) to the list of documents for the selected user (p.2) I don't know which user was selected originally.

Anyone seen this before or have any explanation as to what might be going on?

Thanks for any suggestions.

Martin Perrie
  • 398
  • 5
  • 16
  • Carried out some further testing with a new sessionScope variable. Had no problems with this one, so I suspect it is an issue with my code. However I can find no reference to removing the original variable from sessionScope. To workaround the problem I will just use this new variable. – Martin Perrie Jul 19 '12 at 15:31

1 Answers1

0

you might want to refrain from the parameter approach unless you are sanetizing your input first, so instead of the URL write the userName directly into the scope - or even easier - bind the first field with the categories to the sessionScope. Did u try to modify your code to use a different variable name?

stwissel
  • 20,110
  • 6
  • 54
  • 101
  • Yes - using a different variable name worked, which baffled me a bit! But I will look at changing it to use your suggestions. Thx. – Martin Perrie Jul 24 '12 at 09:55
  • Some things shall not be named. Could be an overlap with cgi variable names. Glad it worked. Plsaccept the answer – stwissel Jul 25 '12 at 13:38