Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

json-plugin and Annotations (OR, implementations of Result that DO not inherit from StrutsResultSupport)

Alex Coles

2008-10-11

Replies: Find Java Web Hosting

Author LoginPost Reply
Using Struts 2.1.2 and json-plugin 0.30.

I've been having issues configuring the json-plugin while using the
@Result annotations.

@Action(name = "items-json")
@Results({
  @Result(name = ListItemsJsonAction.SUCCESS, type =
JSONResult.class, value = "",
  params = { "root", "newsItems" } )
})
public class ListItemsJsonAction extends ListItemsAction
{
}

The code above results in a OGNException:
ognl.NoSuchPropertyException:
com.googlecode.jsonplugin.JSONResult.location

The obvious thing to do would be to remove the value = "" from the
@Result annotation, but this in turn results in an:
java.lang.annotation.IncompleteAnnotationException:
org.apache.struts2.config.Result missing element value


It looks as though its impossible to configure a json-plugin with annotations?
Annotations only appear to work where the Result type has a property
called "location" - inheriting from StrutsResultSupport provides this
(and as such, I haven't had any issue with my custom Result types that
I've written).

This appears to be a bug? For now, the way around this is to use XML
configuration for this particular action and result.


Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.