You can use csjs
combined with ssjs
to solve your requirements.
Take a look at the following example:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" dojoForm="true" dojoParseOnLoad="true" dojoTheme="true">
<xp:this.beforePageLoad><![CDATA[#{javascript:viewScope.title = "Title of the dialog"}]]></xp:this.beforePageLoad>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[dojo.ready(function(){
dojo.require("dijit.Dialog");
// create the dialog:
myDialog = new dijit.Dialog({
title: "#{javascript:viewScope.title}",
content: "test content",
style: "width: 300px"
});
});]]></xp:this.value>
</xp:scriptBlock>
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[myDialog.show();]]></xp:this.script>
</xp:eventHandler>
</xp:button>
</xp:view>
I hope this helps :)