Hi Aaron, I'm running into a similar problem - I'm using a ServletActionRedirectResult instead of the JSONResult. Were you able to work around this? It seems that it's been fixed in 2.1 (cf issue WW-2170) but it doesn't look like it will reach GA anytime soon.
Cheers, GB Aaron Brown-4 wrote: > > > Hi, > > I am attempting to configure a Result implementation using the @Result > class annotation. As part of this configuration I am sending in a > parameters list which contains a single property. Here is my annotation > and simple class file: > > @Result(name = "success", value = "", type = JSONResult.class, params = > {"enableSMD", "true"}) > public class DealJsonAction extends ActionSupport { > > @SMDMethod > public String getName(String client) { > return "testName"; > } > } > > My problem is that the'enableSMD' property is not being set to true on > the JSONResult. > > I have discovered this is happening because the ResultConfig object that > is passed to ObjectFactory.buildResult() has a 'location' parameter in > it. I am not sure where/why this location parameter is being stuck into > the ResultConfig. Further, the buildResult() method calls > OgnlUtil.setProperties and sets the 'throwPropertyExceptions' parameter > to true. This is problematic. > > The JSONResult does not posses a field named 'location'. Therefore, the > call to OgnlUtil.setProperties is throwing an exception when it attempts > to set the location property. This exception causes the iteration over > properties to stop (lines 71-77), and as a result the 'enableSMD' > property is never set on the JSONResult. > > There is a large comment in ObjectFactory, lines 227 - 232, that > comments on catching OGNL exceptions and logging them. The comment > implies there is no issue catching these thrown exceptions and the code > should be rethought in the future. > > In my case, however, the throwing of exceptions is subverting setting > valid properties on the target object. > > I am relatively new to Struts 2, so perhaps I am simply overlooking a > simple configuration step that might remove the 'location' parameter > from the ResultConfig parameters map. Otherwise, it seems the handling > of OGNL property setting needs some attention? > > Any help would be greatly appreciated. > > Thanks, > Aaron Brown > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Problem-in-ObjectFactory.buildResult--OGNLExceptions-can-halt-setting-of-valid-properties-tp12564694p16516520.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]