Note |
---|
Work in progress |
XWork configuration
The base package of your application should extend the webwork-portlet-default package, e.g:
Code Block | ||
---|---|---|
| ||
<include file="webwork-default.xml" /> <package name="view" extends="webwork-portlet-default" namespace="/view"> |
Portlet init parameters
Wiki Markup |
---|
{snippet:id=parameters|javadoc=true|url=com.opensymphony.webwork.portlet.dispatcher.Jsr168Dispatcher} |
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:
...
Code Block | ||
---|---|---|
| ||
<init-param> <!-- Portlet namespace --> <name>portletNamespace</name> <value>/portletA</value> </init-param> <init-param> <!-- The base namespace of the view portlet mode --> <name>viewNamespace</name> <value>/view</value> </init-param> <init-param> <!-- The default action to invoke in view mode --> <name>defaultViewAction</name> <value>index</value> </init-param> |
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.
...
Code Block | ||
---|---|---|
| ||
<result name="success">/displayCart.action?userId=${userId}</result> |
This will set up a render parameter called userId with the value of the userId property of the dispatching action.