To answer my own question. I've spent a very frustrating day trying to fix this!
On my Posts controller I had this @Namespace("/blogs/{blogId}") public class PostsController implements ModelDriven<Object> turns out I needed this @Namespace("/blogs/{blogsId}") public class PostsController implements ModelDriven<Object> Notice that the parameter is blogsId not blogId - it appears that the name matters, Kevin On 22 July 2010 12:31, Kevin Jones <kev.r.jo...@gmail.com> wrote: > I'm using Struts2, REST with the Convention plugin and the > NamedVariablePatternMatcher along with some code that Jeromy Evans > provided for a "HierarchicalRestActionMapper" and all my controllers > are model driven. This nearly all works! > > Let's say I'm building a blog so I want URLs like /blogs/1/posts to > get all the posts for blog 1. To set this up I have a BlogsController > and a PostsController. The PostsController looks like this > > @ParentPackage("default") > @Namespace("/blogs/{blogId}") > public class PostsController implements ModelDriven<Object> > { > private String id; > private Integer blogId; > private List<Object> posts; // = new List<Object>() > SinglePostViewModel postVM = new > SinglePostViewModel(); > > public void setId(String id) > { > this.id = id; > } > > public void setBlogId(Integer blogId) > { > this.blogId = blogId; > } > > public Object getModel() > { > return posts != null ? posts : postVM; > } > > public String index(){} > > public String editNew(){} > > public String create() {} > } > > If I browse to http://.../blogs/1/posts then I see odd behaviour > > If getModel returns a List<Object> then setBlogId is called, however > if getModel returns null or a postVM object then setBlogId is never > called. > > I'm hoping somebody has seen this before and can point me in the right > direction. > > Thanks, > > -- > Kevin > -- Kevin --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org