Request Controller

Every generated output begins with a request that is intercepted by the components control-servlet. The servlet will look up the definition, inside the component’s controller.xml:

Annotation

java
@ControllerConfig(description = "My first Webapp Controller")
public interface MyComponentController {}

@Request(
    uri = "main",
    secure = "true",
    auth = "true"
)
@Response(name = "success", type = "view", value = "main")
public interface Main {}

@View(
    name = "main",
    type = "screen",
    page = "component://mycomponent/widget/MyScreens.xml#main"
)
public interface MainView {}

XML

text
<?xml version="1.0" encoding="UTF-8"?>
<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">

<description>My first Webapp Controller</description>

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

<!-- View Mappings -->
<view-map name="main" type="screen" page="component://mycomponent/widget/MyScreens.xml#main"/>
</site-conf>

The controller consists of event definitions, that can trigger services, or define reqests and view-maps. The request-maps define the route a request has to go through. They can trigger services to run and define what will happen next. They can redirect or forward the user, check for basic security permissions or, most importantly, define whether something is returned to the browser. The view-map itself then generates the result, by either loading a screen definition, or returning an object.

Controller Elements#

Ask the people who wrote it.

Support, development and training from the team that builds Scipio ERP.