You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-dev@incubator.apache.org by James Margaris <jm...@nexaweb.com> on 2006/07/08 00:10:42 UTC

XAP imbedded in HTML

So I checked in some test code, you can see it working in the dojo
widget example. The body of the html is the interesting part:

<body onLoad="Xap.scanPage()">
	<script type="text/javascript">
		DBG = new AjxDebug( AjxDebug.NONE, null, false ); 
	</script>
	
	SOME TEXT
	<h1>SOME BIG TEXT</h1>
	<div context="../../" appName="MyApp" src="dojoExample_0.xal"
toolkit="dojo" >
	</div>

	<!-- MyApp as the app name is a top-level alias for session
	as this event handler illustrates -->	
	<button
onclick="alert(MyApp.getDocumentContainer().getUiDocument().toXml());">h
ello</button>
	FOOTER TEXT
</body>


Things to note:

1: Setting up the application is done declaritively.
2: The application that is created from the .xal page lives under the
div. (This is a bit hard to tell by looking since the app has floating
things)
3: "MyApp" gets declared as a top-level alias for the created session.
You can see the regular HTML button using it as a standard Javascript
object.


I think ideally you could have the entire original XML in the HTML, but
this is tricky for technical reasons. This seems like a good start.

This is just my random stab at this, the individual attribute names and
such are just my wild guess and right now the scanning code only looks
for divs...it's just a proof of concept to get some feedback.

James Margaris