1.Create an XPage and go to the Source panel.
2. Select all the xml code that you see there and replace the same with the following code,
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:sessionScope.Label+="x"}]]></xp:this.action>
</xp:eventHandler></xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:label value="#{javascript:sessionScope.Label}" id="label1">
</xp:label>
</xp:view>
3. Now go to the Design Panel of the XPage.
4. There you go, you will see a Button and a Label as you see in the following screen shot,
sessionScope.Label+="x", and the same is illustrated in the following figure
6. The label needs to have a computed value with the following code in it.
sessionScope.Label, and this is as illustrated in the following figure,
7. Now preview the page on the browser or on a 8.5.1 client and click the button.
8. You will see that the label get changed every time you click the button, and the same is illustrated in the following screen shot
What really happens here is that the label has been mapped to a sessionScope variable.When ever you click the butto, it updates the same and hence the label also gets its value refreshed.
Hope this helps :)
No comments:
Post a Comment