Search code examples
orbeonxforms

Running Orbeon-Form-Builder-Generated-Form with Java Application


Should I be able to run Orbeon-Form-Builder-Generated-Form with Java Application,

i.e. Copy the source of the Form into a simple.JSP (using separate deployment as mentioned in http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications) ?

I found that the evaluation of $form-resources fails. Why ?

simple.jsp XML

    <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
                xmlns:xforms="http://www.w3.org/2002/xforms"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:ev="http://www.w3.org/2001/xml-events"
                xmlns:xi="http://www.w3.org/2001/XInclude"
                xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
                xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
                xmlns:exforms="http://www.exforms.org/exf/1-0"
                xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
                xmlns:saxon="http://saxon.sf.net/"
                xmlns:sql="http://orbeon.org/oxf/xml/sql"
                xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <xhtml:head>
            <xhtml:title>Simple Form</xhtml:title>
            <xforms:model id="fr-form-model">

                <!-- Main instance -->
                <xforms:instance id="fr-form-instance">
                    <form>
                        <section-1>
                            <control-2/>

                        </section-1>
                        <section-2>
                            <control-3/>
                        </section-2>
                    </form>
                </xforms:instance>

                <!-- Bindings -->
                <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
                    <xforms:bind id="section-1-bind" nodeset="section-1">
                        <xforms:bind id="control-2-bind" nodeset="control-2" name="control-2" type="xforms:date"/>

                    </xforms:bind>
                    <xforms:bind id="section-2-bind" nodeset="section-2">
                        <xforms:bind id="control-3-bind" nodeset="control-3" name="control-3"/>
                    </xforms:bind>
                </xforms:bind>

                <!-- Metadata -->
                <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
                    <metadata>
                        <application-name>test</application-name>
                        <form-name>testf</form-name>
                        <title xml:lang="en">Simple Form</title>
                        <description xml:lang="en"/>
                        <author/>
                        <logo mediatype="" filename="" size=""/>
                    </metadata>
                </xforms:instance>

                <!-- Attachments -->
                <xforms:instance id="fr-form-attachments">
                    <attachments>
                        <css mediatype="text/css" filename="" size=""/>
                        <pdf mediatype="application/pdf" filename="" size=""/>
                    </attachments>
                </xforms:instance>

                <!-- All form resources -->
                <!-- Don't make readonly by default in case a service modifies the resources -->
                <xforms:instance id="fr-form-resources" xxforms:readonly="false">
                    <resources>
                        <resource xml:lang="en">
                            <control-3>
                                <label>input 2</label>
                                <hint/>
                                <help/>
                                <alert/>
                            </control-3>
                            <control-2>
                                <label>dATE</label>
                                <hint/>
                                <help/>
                                <alert/>
                            </control-2>
                            <section-1>
                                <label>sec1</label>
                                <help/>
                            </section-1>
                            <section-2>
                                <label>sec2</label>
                                <help/>
                            </section-2>

                        </resource>
                    </resources>
                </xforms:instance>

                <!-- Utility instances for services -->
                <xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all">
                    <request/>
                </xforms:instance>

                <xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all">
                    <response/>
                </xforms:instance>

            </xforms:model>
        </xhtml:head>
        <xhtml:body>
            <fr:view>
                <xforms:label ref="instance('fr-form-metadata')/title"/>
                <fr:body>
                    <fr:section id="section-1-section" bind="section-1-bind">
                        <xforms:label ref="$form-resources/section-1/label"/>
                        <xforms:help ref="$form-resources/section-1/help"/>
                        <fr:grid columns="1">
                            <xhtml:tr>

                                <xhtml:td>
                                    <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                                  xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                                  xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                                  id="control-2-control"
                                                  bind="control-2-bind">
                                        <xforms:label ref="$form-resources/control-2/label"/>
                                        <xforms:hint ref="$form-resources/control-2/hint"/>
                                        <xforms:help ref="$form-resources/control-2/help"/>
                                        <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                    </xforms:input>
                                </xhtml:td>
                            </xhtml:tr>
                        </fr:grid>
                    </fr:section>
                    <fr:section id="section-2-section" bind="section-2-bind">
                        <xforms:label ref="$form-resources/section-2/label"/>
                        <xforms:help ref="$form-resources/section-2/help"/>
                        <fr:grid columns="1">
                            <xhtml:tr>
                                <xhtml:td>
                                    <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                                  xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                                  xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                                  id="control-3-control"
                                                  bind="control-3-bind">
                                        <xforms:label ref="$form-resources/control-3/label"/>
                                        <xforms:hint ref="$form-resources/control-3/hint"/>
                                        <xforms:help ref="$form-resources/control-3/help"/>
                                        <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                    </xforms:input>
                                </xhtml:td>
                            </xhtml:tr>
                        </fr:grid>
                    </fr:section>
                </fr:body>
            </fr:view>
        </xhtml:body>
    </xhtml:html>

Solution

  • The code to support Form Runner in separate deployment was pushed after the 3.9 release. As of this writing, 3.9 is the latest release, so at points you'll need to use a nightly build for this.