I must be doing something wrong because I have tried something similar to what you have described, but no luck.
So I have a hidden input with the following code on my Xpage:
<xp:inputHidden id="inputHidden1"
value="#{javascript:sessionScope.analysisData}"
binding="#{javascript:sessionScope.analysisData}">
</xp:inputHidden>
Then I have a generate analysis button that calls functions in a CSJS script libary to generate an analysis table.
the last two lines run by this code are:
document.getElementById("view:_id1:inputHidden1").innerHTML = exportData; //exportData is a string
alert(document.getElementById("view:_id1:inputHidden1").innerHTML);
Note, I have tried .value as well as .innerHTML. The alert works and displays the data correctly. I can't embed SSJS to get the field id here as that doesn't seem to work in CSJS script libraries.
Then i have my export button:
<xp:button value="Export to Excel" id="button2">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="false">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
print("inputhidden:");
print(getComponent("inputHidden1").getValue()); //This prints null
print("analysisData");
print(sessionScope.analysisData); //This prints null
//sessionScope.analysisData = getComponent("inputHidden1").getValue();}]]></xp:this.script>
</xp:executeScript>
<xp:actionGroup>
<xp:this.condition><![CDATA[#{javascript:
sessionScope.containsKey("analysisData");}]]></xp:this.condition>
<xp:openPage name="Export.xsp"></xp:openPage>
</xp:actionGroup>
</xp:actionGroup>
</xp:this.action></xp:eventHandler></xp:button>
Can you see what I might have done wrong?