Parameter Configurations
Each of the <plugin>, <action>, <filter>, <dispatch> and <exception-handler> elements may be configured to take a set of parameters by specifying nested <param> elements.
Consequently, the PluginConfig, ActionConfig, FilterConfig, DispatchConfig and ExceptionConfig interfaces extend the ParamsConfig interface, which provides the getParamConfig(String) method to lookup a parameter configuration by its name.
A <param> element itself requires the two attributes
- name, specifying the parameter name, and
- value, specifying the parameter value.
The value attribute is dynamic (that is, its value may contain expressions) and of type string.
A parameter configuration is reflected by the ParamConfig interface, which defines the getName() and getValue() methods.
Example
The following action element defines parameter users.
<action path="/login" class="org.foo.bar.LoginAction"> <param name="users" value="/WEB-INF/users.xml"/> <dispatch name="success" action="/welcome"/> <dispatch name="failure" path="/WEB-INF/jsp/login.jsp"/> </action>
Now, the org.foo.bar.LoginAction action implementation might access the corresponding ParamConfig like this:
import de.odysseus.calyxo.control.conf.ParamConfig;
import de.odysseus.calyxo.base.conf.ConfigException;
public class LoginAction extends de.odysseus.calyxo.control.misc.AbstractAction {
private String users;
public void init() throws ConfigException {
ParamConfig param = getActionConfig().getParamConfig("users");
if (param == null) {
throw new ConfigException("Missing parameter 'users'!");
}
users = param.getValue();
}
...
}


