0
votes

I have to pre-populate a xform before displaying it and the data for population comes from a database. I am aware that this can be done using an action or a submission but Is it necessary to pass that data in XML format? Is it possible that my JSP/servlet set a Java object in request and it can directly be used in xform?

Thanks, Yeshasvi

1

1 Answers

3
votes

I've achieved a similar thing for JSR-286 portlets rendering Orbeon XForms. The solution I implemented uses sets a RenderRequest (the Portlet eqivalent of HTTPServletRequest) attributes so it should also work for your Servlet scenario.

I used Apache XMLBeans to create the XForm instance XML before setting it into the request attribute and delegating to Orbeon for XForms rendering using the following XML inside of my XForm:

<xforms:insert ev:event="xforms-model-construct-done" nodeset="instance('nameOfSomeXFormInstance')" origin="xxforms:get-request-attribute('requestXMLAttribute')"/>

Of course you have complete freedom in deciding how you read the data from the database and transform into the XForms instance's XML schema.

Hope this helps.

-Stian