Sharing requestScope across pages - does it really work?

Hi,

The designer help and the wiki say that requestScope variables can exist across pages, if a XPage is requested from another XPage. I tried the example in the help but I can’t get it to work. I have a button in page1 that sets a requestScope variable and opens page2. In page2 my requestScope variable is lost. Is it really possible to share the requestScope across pages?

Thank you for any help.

Roger

http://localhost:2116/help/ntopic/com.ibm.designer.domino.api.doc/r_wpdr_globals_requestscope_r.html

“requestScope allows you to share values across pages for the duration of a request.”

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpages-scoped-variables.htm

“The requestScope variables last for the duration of the request. This means the variables will last for the duration of a url request from the server. The variable can exist across XPages i.e. if an XPage is requested from another XPage.”

Page1:

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp=“http://www.ibm.com/xsp/core”>

field1 =

<xp:inputText id="field1" value="#{requestScope.field1}"></xp:inputText>

<xp:br></xp:br>

<xp:br></xp:br>

<xp:button value="Next" id="button1">

	<xp:eventHandler event="onclick" submit="true"

		refreshMode="complete">

		<xp:this.action><![CDATA[#{javascript:requestScope.put("hello", "Hello");

context.redirectToPage(“Page2”);}]]></xp:this.action>

	</xp:eventHandler>

</xp:button>

</xp:view>

Page2:

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp=“http://www.ibm.com/xsp/core”>

<xp:this.beforePageLoad><![CDATA[#{javascript:print("hello=" + requestScope.get("hello"));}]]></xp:this.beforePageLoad>

hello =

<xp:label id="hello">

	<xp:this.value><![CDATA[#{javascript:requestScope.get("hello");}]]></xp:this.value>

</xp:label>

<xp:br></xp:br>

<xp:br></xp:br>

field1 =

<xp:inputText id="field1" value="#{requestScope.field1}"></xp:inputText>

<xp:br></xp:br>

<xp:br></xp:br>

field2 =

<xp:inputText id="field2" value="#{requestScope.field2}"></xp:inputText>

</xp:view>