I stripped the original app right down to a simple controller and
built things up from nothing (the original app had all sorts of stuff
like Spring and Hibernate which was getting in the way).

The problem appears to happen only when I use the @Action annotation.
If I take out the annotations then I get proper REST dispatching (i.e.
the 'default' action is index, the 'new' action maps to editNew etc),
However as soon as I add @Action all the mapping seems to go out the
window and everything goes through the index method. Am I missing
something obvious?

It appears the solution is not to use the @Action annotations but
instead to add an @Results collection to the controller class.

This appears to work

@Results( {
    @Result(name = "index", location = "index", type = "tiles"),
    @Result(name = "show", location = "show", type = "tiles")
})
public class SimpleController
{
    public string index(){return "index";}
    public string show(){return "show";}
}

In both apps I'm using Tiles but the problem was the same whether or
not I was using Tiles, the routing simply didn't work,

Kevin

On 16 July 2010 09:54, Frans Thamura <fr...@meruvian.org> wrote:
> Just curious
>
> Is there a production using rest plugibs
> (m)
>
> -----Original Message-----
> From: Johannes Geppert <jo...@web.de>
> Date: Fri, 16 Jul 2010 01:31:30
> To: <user@struts.apache.org>
> Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
> Subject: Re: Struts, Convention plugin and REST plugin
>
>
> did it work when you don't use the action annotations ?
> Because with Rest Plugin you have already an action called "posts"
>
> Try it only with the Results annotations.
> @Results( {
> �...@result(name="newpost", location="newpost"),
> �...@result(name="posts", location="posts")
> })
> public class PostsController implements Preparable,
>                ModelDriven<List<PostViewModel>>
> {
> public String editNew()
> {
>        return "newpost";
> }
>
> public String index()
> {
>        return "posts";
> }
>
> }
>
> Best Regards
>
> Johannes Geppert
>
>
> Kevin Jones-10 wrote:
>>
>> I'm having a problem using Struts/Convention/REST together/
>>
>> I have a class that looks like this
>>
>> public class PostsController implements Preparable,
>>               ModelDriven<List<PostViewModel>>
>> {
>> }
>>
>> with two 'action' methods
>>
>> @Action(result...@result(name="newpost", location="newpost")})
>> public String editNew()
>> {
>>       return "newpost";
>> }
>>
>> @Action(result...@result(name="posts", location="posts")})
>> public String index()
>> {
>>       return "posts";
>> }
>>
>>
>> Originally I only had the index method and it worked fine. After
>> adding the editNew method the index method has stopped working (the
>> editNew method works fine).
>>
>> If I comment out the @Action above the editNew method then the index
>> method starts working (and the editNew stops working).
>>
>> Depending on the method that's not working the error I get is "No
>> result defined for action com.mantiso.jsblog.actions.PostsController
>> and result newpost"
>> or "No result defined for action
>> com.mantiso.jsblog.actions.PostsController and result posts"
>>
>> Any help would be gratefully accepted,
>>
>> --
>> Kevin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
>
> -----
> ---
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
>
> --
> View this message in context: 
> http://old.nabble.com/Struts%2C-Convention-plugin-and-REST-plugin-tp29177483p29181314.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to