|
From: Colin S. <col...@ex...> - 2005-03-11 20:47:46
|
Alef, I was looking at your blog entry about the topic of supporting multiple command objects in the form controllers. http://blog.arendsen.net/?p=23 I actually think it'd be an excellent idea to take a more exhaustive look at WebWork in terms of plugging any deficiencies in Spring MVC in terms of things that WebWork can do easily which Spring MVC can't. (at the same time, as I mentioned to Jason Carreirra at TSSJS, I'd like to also make it easier for people to use WebWork with Spring if they really want to, by at least pointing to some of the integration code and documenting its existence a bit better). However, on the subject of supporting binding to multiple command objects, the idiom I've found pretty handy in the case is simply to have a static inner class in my controler for this purpose. It's completely trivial to do: public XXXXX extends AbstractFormController { . . . public static class Command { MyDomainObject myDomainObject = new MyDomainObject(); MyOtherObject myOtherObject = new MyOtherObject(); public MyDomainObject getMyDomainObject() { return myDomainObject } public MyOtherObject getMyOtherObject() { return myOtherObject } } } There's no need for anybody else other than the JSP page or the controller to know about this inner Command class, and code management is super-simple... Colin |