On Sun, Oct 12, 2008 at 5:51 AM, Wes Wannemacher <[EMAIL PROTECTED]> wrote: > On Sun, 2008-10-12 at 05:29 +0200, Alex Coles wrote: >> Hi Wes, >> >> Thanks for your response! >> >> On Sun, Oct 12, 2008 at 5:15 AM, Wes Wannemacher <[EMAIL PROTECTED]> wrote: >> > It's funny that you happened to ask this tonight, I am working on a JSON >> > result with annotations as I am writing this... >> > >> > First off, are you using a plugin to provide the annotations? If so, >> > which one. I am using struts-2.1.3-snapshot (which might make a >> > difference) in conjunction with the conventions plugin. >> >> Sorry, I don't understand what you mean by using a plugin to provide >> the annotations? >> >> I am using several different Result types, most of which I wrote >> myself. However, in the case of JSON, I went with the json-plugin >> here: http://cwiki.apache.org/S2PLUGINS/json-plugin.html >> > > The reason I ask is that to do XML-less configuration, I will typically > grab one of the plugins that helps. In my case, I like the new > conventions plugin. This provides my @Action annotation... I use the > org.apache.struts2.convention.annotation.Action annotation.
Thanks! I was using the @org.apache.struts2.config.Action and @org.apache.struts2.config.Result annotations. I haven't had the convention plugin enabled. >> > I have an action with the following annotation and it is working fine >> > for me - >> > >> > @Action([EMAIL PROTECTED](name="success",type="json")}) >> > >> >> If I ommit the value = "" parameter from my @Result annotation, then I >> am getting a java.lang.annotation.IncompleteAnnotationException: >> org.apache.struts2.config.Result missing element value >> >> I am using Struts 2.1.2, and not 2.1.3-SNAPSHOT. Perhaps something >> changed along the way? > > This is my guess as to the culprit. There is another issue that I'm > wondering about though. In my project, I am using Maven, so I noticed > right away that the JSON plugin was built against Struts 2.0.x. I had to > patch it to get Maven to compile it and make it available to my > project. > > Anyhow, I would suggest compiling the latest from SVN and try with > 2.1.3-SNAPSHOT. If that doesn't work, check the convention plugin - > > http://cwiki.apache.org/S2PLUGINS/convention-plugin.html > > My @Result annotation comes from this plugin (rather than struts-core) > and that could be the difference as well. > Thanks again, Wes. I should take a look at the conventions plugin. I think for now I will go with XML configuration for this particular use-case in my application (as I need to deploy very soon). I am a pretty new convert to Struts 2 (coming from Spring MVC) and while I like its power, I find the choices for configuration styles a little bewildering! I'll look at the snapshot too - although not for the application I am about to launch in production! Thanks, Alex --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]