# LivePage

This HOWTO documents the LivePage class, part of the Woven framework. The Woven framework should not be used for new projects. The newer Nevow framework, available as part of the Quotient project, is a simpler framework with consistent semantics and better testing and is strongly recommended over Woven.

The Woven documentation below is maintained only for users with an existing Woven codebase. The LivePage HOWTO is just a quick bootstrap page in any case.

To use LivePage, subclass or instantiate `LivePage` instead of `Page`. Then, in your HTML template, include the following HTML fragment somewhere towards the bottom of the page:

      <span view="webConduitGlue" />

Then, Event handlers can forward client-side JavaScript events to the Server, and you can send JavaScript to the browser after a page has already loaded. Example:

    class Foo(page.LivePage):
        template = ('<html><body>'
                    'Nothing here!<span view="webConduitGlue" />'
    		'</body></html>')
        def setUp(self, request):
            global currentPage

            # don't save this in a global but somewhere your code can get
            # to it later
            currentPage = request.getSession(interfaces.IWovenLivePage)

    # then later, in response to some server-side event
    def fooHappened():
        global currentPage

        currentPage.sendScript("alert('hello, world!')")