14.5.2 Embed the component

The following <Script> tag must be included in the body of the HTML

<script src="/[path]/[runtime]/lansa.js"></script>

[path] will be the location of the LANSA runtime folder.

[runtime] will be the versioned runtime name, for example: lansa_14_0_0_1

Create an empty DIV element to act as the container for the LANSA reusable part.

This is a simplest way to do this. You must specify a DIV tag with an ID:

<div id="LANSAFrame" style="top:0px;left:10%;width:80%;height:800px;position:absolute"></div>


Additional script can be added

Once the Script tag and DIV are in place, additional script can be added to initialize the LANSA runtime and to execute the reusable part:

var myPart = null;


// Initialize the LANSA runtime

LANSA.init({sys:"%{lansa_webalias}%",part:"%{lansa_partition}%",lang:{ def:"ENG",code: { "ENG":"en-US", "FRA":"fr-FR", "JPN":"ja-JP" } },splash:{ limg:"spin",txt:"Loading..." } } );

// Create the reusable part, it will fill up the nominated DIV

LANSA.showPart( "[partname]", "[container]", function( newPart )


// This callback gets called when the LANSA runtime is loaded and the part is created, you can now interact with the part - or just remember it and interact with it later

   myPart = newPart;

} );

[partname] will be the identifier of the reusable part

[container] will be the name of the DIV in which the reusable part will be housed e.g. LANSAFrame.

As soon as the runtime comes alive, the part will be created and positioned in the container.