Versions Compared

Key

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

Work in progress

 

 

XWork configuration

The base package of your application should extend the webwork-portlet-default package, e.g:

Code Block
titlexwork.xml
<include file="webwork-default.xml" />

<package name="view" extends="webwork-portlet-default" namespace="/view">

 

 

Portlet init parameters

Below is the init-param elements that you can set up in portlet.xml for configuring the portlet mode -> xwork namespace mappings for the portlet. Basically, you can think of the different portlet modes as different sub-applications, so it can be useful to set up the xwork.xml configuration with different namespaces for the different portlets and modes:

...

This snippet from portlet.xml will set up the portlet with a namespace of /portletA/. This means that all requests to this portlet will get the namespace prepended when looking up the action. In addition, the _view portlet mode will map to the /view namespace, so a request for action myAction will resolve to the namespace and action /portletA/view/myAction. It also means that if no action is requested, the default action of index will be used for the request.

Portlet phases

The portlet specification describes that a portlet request cycle can consist of two phases, an event phase and a render phase. In case of an event in the portlet, it will always execute before the render phase. The event phase is typically for changing the state of the application. In a portlet, this is typically when a form is submitted. The render pahse will then prepare and dispatch to the view. It's recommended that you set up the result from an action that is executed in the event phase to point to another action that is executed in the render phase, which again is responsible for dispatching to the actual view.

Portlet result dispatching

The webwork-portlet-default package defines a special default result type, which is responsible for performing the result logic of an Action execution. Typically, this involves including a JSP for rendering, or preparing a render action if one is configured for the current event action.

...