Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Attribute NameRequired?Description
nameYThe name of this view mapping, matches the value of the response element.
pageNThe page mapped to this view.
typeNThe type of view this is, maps to a ViewHandler. An empty type will assume JSP type view.
infoNExtended information passed to the view handler.

Event Handler

...

Event Handlers are defined in the XML config file such as:

  <handler name="java" type="request" class="org.ofbiz.webapp.event.JavaEventHandler"/>

As in the above request mapping the login event is defined with a type of java. The event type is mapped to an Event Handler using the handler definitions. Custom Event Handlers can be designed and would be implemented like the above example.

Java events are processed by locating the path of the event (package and classname); then, by using the Reflection API, the Event Handler invokes the method defined. A String object is returned to the Request Handler which is mapped to the response element of the request definition.

View Handler

View Handlers are defined just like Event Handlers, except the type is view:

  <handler name="region" type="view" class="org.ofbiz.webapp.view.RegionViewHandler"/>

The view handler handles rendering the next page the user will see. The default view handler supports standard html/jsp pages by dispatching to the page defined in the view definition. Other view handlers like region and velocity use special logic to render the page to the user.

Custom view handlers can be created easily by implementing the ViewHandler interface and setting a definition in the controller.xml file like the above example.