This is a situaion that comes up often in portal deployment where multiple GI application could be loaded at the same time. GI provides a deployment configuration that allows you to run multiple instance of the same application.
jsxappns Application namespace. For example, jsxappns="myAPP". Since every application deployed on a single page must have a unique namespace, overriding the namespace can be useful when an application is multi-instantiated on the same page. However, the application must be written to never reference its namespace directly. |
This configuration is set at the launch script tag for GI. you can find more information here Deployment Parameters
However, the developer often times build into their application code direct reference to the server name, since that is the easy way.
So, for an application to be runnable in a multi-instance deployment, the developer must take care not to use a static application server reference.
For example, you should design the code to be flexible by specifying the app server as a parameter to methods that requires it.
Here's a theme loader method
Service.loadTheme = function(objGUI, server) {
server.loadInclude(server.resolveURI("jss/mydyna.xml?"+new Date().getTime()), "mydyna_xml", "jss");
server.getBodyBlock().repaint()
}
Now how do you get the server instance without refering to a static name? If the method is invoked thought a GUI object interaction the answer is there. Each GUI object are initialized in the application server context it was started from, so it can invoke objGUI.getServer() instead of doing a static name reference.
Service.loadTheme2 = function(objButton) {
var server = objButton.getServer();
server.loadInclude(server.resolveURI("jss/mydyna2.xml?"+new Date().getTime()), mydyna_xml", "jss");
server.getBodyBlock().repaint();
}
What if the method is not invoked through GUI interaction? The server instance can be obtained during execution of
- Project "onload" execution and accessible through this pointer (e.g. myOnLoadFunction(this);
- During deserialization of the app canvas, the onAfterDeserialized is passed the top GUI object as objJSX.
So you can use either place to initialize
<serialization xmlns="urn:tibco.com/v3.0" jsxversion="3.7">
<name/>
<icon/>
<description/>
<onBeforeDeserialize/>
<onAfterDeserialize>eg.service.setServer( objJSX.getNS(), objJSX.getServer();</onAfterDeserialize>
</serialization>
jsx3.lang.Package.definePackage(
"eg.service", //the full name of the package to create
function(service) { //name the argument of this function
service.APP = {}; // application server instance
service.setServer = function(name, server) {
service.APP[name] = server;
}
service.getServer = function(name) {
return service.APP[name];
}
Service.loadTheme1 = function(objButton) {
var server = service.getServer(objButton.getNS());
server.loadInclude(server.resolveURI("jss/mydyna.xml?"+new Date().getTime()), "mydyna_xml", "jss");
server.getBodyBlock().repaint();
}
Service.loadTheme2 = function(objButton) {
var server = objButton.getServer();
server.loadInclude(server.resolveURI("jss/mydyna2.xml?"+new Date().getTime()), mydyna_xml", "jss");
server.getBodyBlock().repaint();
}
});
hi,
i'm using Portal BEA ALUI 6.1MP1;
I tryed to place two instance of the Chart sample application into the same portal page.
Applications are proxyed by the portal.
I setted different values of jsxapppath parameter for each instance of application to allow multiple instance: "it.Lab723.Chart" and "it.Lab723.Chart2"
Nevetheless I have an error on page loading:
"boot.env_reset jsxabspath URL_Chart1 URL_Chart2"
If I reload page, error changes into:
"Error redefining JSX environment parameter jsxabspath from URL_Chart1 to URL_Chart2"
where
URL_Chart1 and URL_Chart2 are the proxyed address of the two instances of application.
I have the same error if I try to place two different application into the same page: Chart and WSDL_Mapping_2 examples.
I suppose that problem insn't into the application but into the JSX engine.
Can you help me?