Using ServletActionRedirectResult (within @Result) and extra parameters. ------------------------------------------------------------------------
Key: WW-2297 URL: https://issues.apache.org/struts/browse/WW-2297 Project: Struts 2 Issue Type: Bug Affects Versions: 2.0.11 Reporter: David Artiga Given the following class and annotations: @Results( @Result(name = Action.SUCCESS, value = "myAction", type=ServletActionRedirectResult.class, params = { "param1", "value1" }) ) public class MyAction implements Action { ... } In method 'buildResult' from 'com.opensymphony.xwork2ObjectFactory' class: if (resultClassName != null) { result = (Result) buildBean(resultClassName, extraContext); try { OgnlUtil.setProperties(resultConfig.getParams(), result, extraContext, true); } catch (XWorkException ex) { ... } ... } When dealing with the readult an ognl.NoSuchPropertyException is thrown for property 'param1'. This is not a problem if the action is mapped using a XML file, because "actionName" property has been set earlier (resultConfig.requestParameters = { "actionName=myAction","param1=value1"}). But when using annotations, the requestParameters order changes( {"param1=value1", "actionName=myAction"}), so when throwing the exception "actioName" has not been set yet, and then the Result created has no actionName (=null). That causes a NullPointerException when trying to process the result. Possible patch (inform Ognl to not throw exceptions when setting properties): OgnlUtil.setProperties(resultConfig.getParams(), result, extraContext, /* --> */ false /* <-- */ ); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.