com.oroad.stxx.xform
Class XMLFormHandler

java.lang.Object
  extended bycom.oroad.stxx.xform.XMLFormHandler

public class XMLFormHandler
extends java.lang.Object

Loads and populates xml forms.

Author:
Don Brown

Constructor Summary
XMLFormHandler()
           
 
Method Summary
protected  org.w3c.dom.Document extractModel(java.lang.String path)
          Extracts an xml form model from an xform file
 void init(javax.servlet.ServletContext ctx, org.apache.struts.config.ModuleConfig moduleConfig, java.util.Map moduleProps, StxxProperties stxxProps)
          Initializes variables and loads the xml models from either an xml model file or the xforms themselves.
protected  void loadModelsFromXForms()
          Loads the xml form models from within the xforms themselves.
protected  void loadModelsFromXML(java.lang.String path)
          Loads the xml form models from the model xml file.
 void populateXMLForm(org.apache.struts.action.ActionMapping mapping, XMLForm xform, javax.servlet.http.HttpServletRequest request)
          Populates the XML form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFormHandler

public XMLFormHandler()
Method Detail

init

public void init(javax.servlet.ServletContext ctx,
                 org.apache.struts.config.ModuleConfig moduleConfig,
                 java.util.Map moduleProps,
                 StxxProperties stxxProps)
          throws javax.servlet.ServletException
Initializes variables and loads the xml models from either an xml model file or the xforms themselves.

Parameters:
ctx - The servlet context
moduleConfig - The module config
moduleProps - The stxx plugin properties
stxxProps - stxx properties
Throws:
javax.servlet.ServletException - If anything goes wrong

populateXMLForm

public void populateXMLForm(org.apache.struts.action.ActionMapping mapping,
                            XMLForm xform,
                            javax.servlet.http.HttpServletRequest request)
Populates the XML form. If the form isn't initializes, it is initialized with the configured validation and model information. Otherwise, it is populated. If viewstate is enabled, it is loaded before population.

Parameters:
mapping - The action mapping
xform - The xml form
request - The http request

loadModelsFromXForms

protected void loadModelsFromXForms()
                             throws javax.servlet.ServletException
Loads the xml form models from within the xforms themselves.

Throws:
javax.servlet.ServletException - If something goes wrong

loadModelsFromXML

protected void loadModelsFromXML(java.lang.String path)
                          throws javax.servlet.ServletException
Loads the xml form models from the model xml file.

Parameters:
path - The path to the model xml file
Throws:
javax.servlet.ServletException - If something goes wrong

extractModel

protected org.w3c.dom.Document extractModel(java.lang.String path)
                                     throws javax.servlet.ServletException
Extracts an xml form model from an xform file

Parameters:
path - The path to the xform file
Returns:
The model xml document
Throws:
javax.servlet.ServletException - If something goes wrong