Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Typos and grammar corrections.

...

The request map for the URI main looks like this:

Code Block

<request-map uri="main">
    <security https="true" auth="true"/>
    <response name="success" type="view" value="main"/>
</request-map>

...

The outcome of any processing (which is a string) determines which response to the request is rendered and sent back. In our example, there is only one response to choose from, which is:

Code Block

<response name="success" type="view" value="main"/>

...

Let's look at the view-map entry for the view with the name main:

Code Block

<view-map name="main" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#findparty"/>

...

The information from the view-map element is resolved against the handlers defined by the elements of type handler, usually in the first section of the controller.xml document. As we are rendering a view, we're only interested in handlers of type "view", so we do a lookup for a handler with type="view" and name="screen":

Code Block

<handler name="screen" type="view" class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/>

...

The control servlet will now pass on the processing to the specified view handler by calling the render method using the a, b and c as parameters. It's entirely up to the implementation of the view handler to generate the response and write it to the servlet response channel.

Panel

Hint: So if If you wanted to implement a view handler which is not based on the OFBiz widgets toolkit but using whatever other view technology, as long as it's a servlet based technology, you would have to implement your own ViewHandler class and make it known to the controller servlet by adding a handler element to the controller.xml file. Then you could create one or more view-map elements with the type="yournewhandler" and have any response in a request-map dispatch processing to that view.

...

  • Labels actions
    • property-map: to define labels (in a map) from a xml labels file
    • property-to-field: to define a field value from a properties file
  • Entity actions, this is simple action directly on entities, they are
    • entity-and
    • entity-condition
    • entity-one
    • get-related-one
    • get-related
  • Set actions, mostly 2 "sub-types"
    • set : simple assignation
    • use of Groovy snippet for a bit more involved assignation (filtered, modified, etc.). Advantage: noe no need to create/open a new file, immediately visible/readable.
      • syntax : <set field="fieldName" value="${groovy: 1+1}"/> (you may need to set a type using the type attribute of the set element)
  • Script
    • script: to call a Groovy script from a file, not short enough to be snippet
  • Service
    • service: to call a service

...

A decorator literally takes the net content of the screen and decorates is it with everything else which you will see on the screen later. For example, the net content of the findparty screen is just the search form, consisting of some field labels and , fields, and a submit button. But when When the page is rendered in the browser, it needs to have headers, footers, the menu bar, etc. All these elements are added by the decorator.

...

A typical place to look for the definition of the mainDecoratorLocation parameter would be the WEB-INF/web.xml file of the respective webapp, where this parameter can be defined as a context parameter of the web application. In our example (the partymgr app) you will find the following data there:

Code Block

<context-param>
  <param-name>mainDecoratorLocation</param-name>
    <param-value>component://party/widget/partymgr/CommonScreens.xml</param-value>
    <description>The location of the main-decorator screen to use for this webapp; referred to as a context variable in screen def XML files.</description>
</context-param>

...

In case the user has the right to view the findparty form, the actual form content is rendered, controlled by the following XML fragment:

Code Block

<widgets>
  <platform-specific>
    <html>
      <html-template location="component://party/webapp/partymgr/party/findparty.ftl"/>
    </html>
  </platform-specific>
</widgets>

...