On 6 Jun 2006, at 09:56, Ben Fortuna wrote: > Hi all, > > I've been investigating the possibilities of integrating Wicket and > OSGi with favourable results. However, one major hurdle, which I think > a couple of others have also pointed out here, is that there is as yet > no solution providing "true" dependency injection for Wicket.
Hi Ben, I use picocontainer to Inject services into my pages by supplying my own PageFactory. This works very well but you need to make sure that any services that are injected can be serialized and deserialized and remain consistent. Even if you are not using clustering wicket uses serialization to clone pages when a new browser window is opened. > > With my basic knowledge of Wicket, this example would seem impossible > as there must be a "placeholder" in the page's HTML that will > correspond to each of the components in the page's component tree. So > ultimately it seems the page component count cannot be altered at > runtime. I did not consider page components as services that should be injected and in 2.0 with the parent component in the constructor it would be impossible to pass a child component to a parent. But you can pass in a factory class that could create the correct component type at instantiation time. Or you could use subclasses to override methods such as this: protected void createMyPlacholderPanel(parentComponent) John _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user