Hi,
First of all could you explain the reason why you require 2 XPages? The Dsicussion and Teamroom templates that ship with the ExtLib have multiple views and pages to open documents in the same XPage, perhaps there is a different issue you are facing.
I have done up a quick example of computing the "selectedPageName" property of the singlePageApp control, in this example I have 2 XPages, mobile1.xsp has 2 appPages with a button to switch views and a button to move to mobile2.xsp. on mobile2.xsp I have a button that when clicked will return to whatever mobile page you clicked to get to the second page. Here is the code:
** This example requires an application with access to the EXtLib and the "xsp.theme.mobile.pagePrefix" property set to "mobile" in the xsp.properties **
mobile1.xsp
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:singlePageApp id="DiscussionApp">
<xp:this.selectedPageName><![CDATA[#{javascript:
if(null == sessionScope.selectedPage)
{
print('Inside null');
return "mobile1";
}
else
{
print('Inside value: ' + sessionScope.selectedPage);
return sessionScope.selectedPage;
}
}]]></xp:this.selectedPageName>
<xe:appPage resetContent="true" id="mobile1"
pageName="mobile1">
<xe:djxmHeading id="djxmHeading1" label="All Documents">
</xe:djxmHeading>
<xp:label value="This is page 1, view 1"></xp:label>
<xp:br></xp:br>
<xp:button value="Move to page 2" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
sessionScope.selectedPage = "mobile1";
context.redirectToPage("/mobile2.xsp");
}]]></xp:this.script>
</xp:executeScript>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Move to view 2" id="button3">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xe:moveTo direction="Left to Right"
targetPage="mobile2" transitionType="slide">
</xe:moveTo>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xe:appPage>
<xe:appPage resetContent="true" id="mobile2"
pageName="mobile2">
<xe:djxmHeading id="djxmHeading2" label="Most recent">
</xe:djxmHeading>
<xp:label value="This is page 1, view 2"></xp:label>
<xp:br></xp:br>
<xp:button value="Move to page 2" id="button2">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
sessionScope.selectedPage = "mobile2";
context.redirectToPage("/mobile2.xsp");
}]]></xp:this.script>
</xp:executeScript>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Move to view 1" id="button4">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xe:moveTo direction="Left to Right"
targetPage="mobile1" transitionType="slide">
</xe:moveTo>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xe:appPage>
</xe:singlePageApp>
</xp:view>
mobile2.xsp
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:singlePageApp id="DiscussionApp" selectedPageName="mobile3Home">
<xe:appPage resetContent="true" id="mobile3Home" pageName="mobile3Home">
<xe:djxmHeading id="djxmHeading1" label="Page 2">
</xe:djxmHeading>
<xp:button value="Back to view #{javascript:param.from}" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
context.redirectToPage("/mobile1.xsp");
}]]></xp:this.script>
</xp:executeScript>
</xp:this.action></xp:eventHandler>
</xp:button>
</xe:appPage>
</xe:singlePageApp>
</xp:view>