Database Reference
In-Depth Information
betterForm
betterForm is an open source (BSD and Apache2 licensed) server-side XForms 1.1
processor written in Java. To say that betterForm only runs on the server side would
be unfair; the majority of the processing happens server-side, but the server also gen‐
erates JavaScript and HTML5 (or XHTML) for the web browser to represent your
XForm UI. All UI interaction in the browser and subsequent incremental updating is
processed by JavaScript with Ajax calls back to the server.
betterForm comes already bundled with eXist, and thus there is no installation or
configuration required to start immediately working with XForms using betterForm
and eXist. It really could not be simpler!
How does this work, you ask? The simple explanation is that betterForm acts as a fil‐
ter between eXist and all HTTP traffic. If betterForm detects that eXist is returning
an XML document that contains an XForm, it will transparently intercept this and
replace the XForm with an HTML form, CSS, and JavaScript. Likewise, when the
form UI is interacted with, or instances need to be submitted or updated, betterForm
intercepts these requests to eXist and takes care of processing the state of the XForm
before passing the request on to eXist.
By default eXist and betterForm are configured such that any documents stored into
the database that are delivered over the URI /exist/apps can be intercepted and pro‐
cessed by betterForm. Remember that the URI /exist/apps is mapped onto the collec‐
tion /db/apps by the XQuery URL rewriting controller (see “The controller-
config.xml Configuration File” on page 206 ). Therefore, any documents containing
XForms stored into the database collection /db/apps (or a subcollection of it) and
requested by a URI starting with /exist/apps will be processed by betterForm.
Additional Tips for Working with betterForm
Here are some hints and tips for working with betterForm effectively:
• You can change the URI path that betterForm post-processes by adjusting the
XFormsFilter url-pattern in $EXIST_HOME/webapp/WEB-INF/web.xml , after
which you must restart eXist for the change to take effect. For example:
<filter-mapping>
<filter-name> XFormsFilter </filter-name>
<url-pattern> /apps/* </url-pattern>
</filter-mapping>
• Should you wish to entirely disable betterForm post-processing, you may do so
by changing filter.ignoreResponseBody to true in $EXIST_HOME/webapp/
WEB-INF/betterform-config.xml , after which you must restart eXist for the
change to take effect. For example:
 
Search WWH ::




Custom Search