I spent some time this weekend trying to get Laszlo to load my Spring
ApplicationContext into a page.  I was successful in getting it, but
I'm having trouble grabbing a bean from it, and calling it's methods. 
Is this possible with Laszlo?  Here's what I have so far:


<canvas width="100%" height="500" debug="true">

    <debug x="300" y="20" width="500" height="400"/>

    <webapprpc id="webapp" autoload="true">

        <method event="onload">
            Debug.write('webapp object loaded');
            canvas.buttons.setAttribute('visible', true);
        </method>

        <remotecall name="getAttr" funcname="getAttribute"/>

    </webapprpc>


    <view name="buttons" x="10" y="10" layout="spacing: 5" visible="false">

        <view x="20" layout="spacing: 5">

            <attribute name="myDel" value="null" type="expression"/>

            <method event="oninit">
                this.myDel = new LzDelegate(this, 'handler');
            </method>

            <method name="handler" args="data">
                Debug.write('handler:', data);
            </method>

            <button text="getAttributeNames"
onclick="webapp.getAttributeNames.invoke()"/>

            <button text="getApplicationContext"
onclick="webapp.getAttr.invoke(['interface
org.springframework.web.context.WebApplicationContext.ROOT'])"/>

            <button text="getApplicationContext w/ delegate">
                <method event="onclick">
                    webapp.getAttr.invoke(['interface
org.springframework.web.context.WebApplicationContext.ROOT'],
parent.myDel);
                </method>
            </button>
        </view>
    </view>
</canvas>


<random thought>
Is there any interest/value in adding a <springrpc> tag that allows
getting beans and calling their methods directly from Laszlo? 
Personally, I don't know if this is a good idea b/c Laszlo seems to to
deal with XML much better than real Java objects.
</random thought>

Thanks,

Matt

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to