o JSF exists as a parallel world of UIComponents and UIComponentTags that
are associated with each other--the latter are used directly in JSP pages.
o Basic problem to be addressed with the command button: how do you reuse
action code, or how do you build up custom actions from pre-defined atomic
action pieces? The default behaviour of UICommand extensions is to bind
Backing Bean code to the component through the "action" attribute,
like so:
But the runCommand may typically be a set of common operations that are
contained in an OGRE or Karajan script. What we'd really like is
....
....
Here the tag acts as an outer envelop for the script tag.
The "processor" attribute allows you to set the engine that will handle
the contained script (either Karajan or OGRE or whatever). Note of course this
class may not be specifically needed, since it doesn't do much and the
"processor" attribute could be added to the commandButton tag.
o How do you do this? JSF development has two main branches: tag class development
that is used for JSP integration and abstract component development.
o The following are abstract component classes:
- OGCECommand: this is an extension to UICommand and will act as a parent
to the classes below.
- OGCEActionSet: this is a non-rendered class that contains the processor
attribute. It should extend UIComponent. Its main jobs are to instatiate
the appropriate processor
engine "karajan" or whatever, load up the child tags, and pass the
scriptlet to the processing engine.
- Currently I assume that the actual workflow script is an externally
defined XML markup (Karaja, OGRE, Ant), so we don't need to provide
this.
o These are the tag components:
- OGCECommandTag: this will contain one "" tag and should extend the
UIComponentTag class.
- OGCEActionSetBodyTag: this corresponds to the tag. This is
an extension of UIComponentBodyTag, since we will need to process the entire
body at once. That is, the elements and their children will
need to be passed immediately and entirely to the Karajan engine.
o To accomplish this, we must build these things up in steps.
o Step 1: Write a trivial UICommand component extension and tag. The classes
should be OGCECommandButton and OGCECommandButtonTab. Use the standard
button renderer. The point of this exercise is the see how to register new
components and tags with JSF. Verify that it works by writing a simple JSF
example.
o Step 2: Write a new component, OGCEActionSet, that extends UIComponent. Also write the
corresponding OGCEActionSetTag class that binds to .
Modify OGCECommandButton so that it recognizes OGCEActionSet instances as child elements.
Verify that it works by writing a simple JSF example. Things to test: the parent
OGCECommandButton should be able to retreive the specific ID values of its children.
o Step 4: Show how to insert arbitrary, valid XML into the OGCEActionSet, how to
instantiate a processor, and how to pass the XML to the processor. This should not
really do anything, but just demonstrate how to programmatically get the XML from the
JSF to the processor class.
o Step 5: Write a binding to a real processor (like Karajan) and pass the child elements of
to the processing engine.