I agree. The problem is that if pages were to be injected they have to be created wih no contructor arguments. And that works with only few of my pages. Most of them do use constructor arguments. Having the posibility to use constructor arguments to pass data between pages is IMHO one of the bigest wicket benefit.

The same goes with injecting components. AFAIK it makes no sense to inject pages without injecting components, because often it's components that needs the underlying services. And each component requires at least one constructor argument (id).

Phil Kulak wrote:
I've been toying with these problems for a while, and others have
before me. The ideal solution IS to have pages constructed and
injected, and that can be done, actually. The problem is that you
loose the ability to have many different constructors and you can't do
anything in a constructor because the dependencies haven't been set
yet. JSF and Tapestry have heavily managed pages, so these things were
present before any kind of IOC integration.

Dependency injection is great and all, but I think it's fine to have
pages do look ups. I can still do injection on all my singletons, and
that's where most of the convenience lies anyway (transaction
proxying, setting up session factories, and the like).

On 7/11/05, Gustavo Hexsel <[EMAIL PROTECTED]> wrote:

 The best solution, IMHO, would be to have a spring class that would create the 
pages for you, with all dependencies set.  It would have to be a bridge between 
spring's ApplicationContext and wicket's PageFactory.

 For instance, instead of having a BookListPage.class that calls 
Book.listAll(), it would have a reference to ListBooks or BookServices or 
whatever your nomenclature is, and not to worry about having to find that.  The 
ApplicationContext, or the PageFactory, or some other configurator, would set 
the dependencies upon page creation.

 I understand Tomcat would not be able to recover the context from a serializable servlet 
context, and I don't have any immediate solutions for that.  I'm just thinking on how 
dependency injection works...  if you have to "ask" for anything from an 
application context, you're using a more flexible form of service locator.  It works, but 
it's not what Spring originally intended.

 []s Gus


---------- Início da mensagem original -----------

     De: [EMAIL PROTECTED]
   Para: [email protected]
     Cc:
   Data: Mon, 11 Jul 2005 19:13:16 +0200
Assunto: Re: [Wicket-user] Spring Integration


What would you need to make it pretty? If you have concrete idea's on
how we can improve Wicket for this, please share them.

Eelco

Gustavo Hexsel wrote:


One possible way would be to have a parent page class that would hold it, and 
customize your page factory to set it in all created pages.  It's pretty easy.  
Let me know if you can't picture it and I'll try to write a sample code.

I use dependency injection in most of my pages and unfortunately, it doesn't 
look nearly as pretty as I wanted it to.  Most Wicket examples favour service 
locator instead... I guess you might find yourself in the same boat.

[]s Gus


---------- Início da mensagem original -----------

    De: [EMAIL PROTECTED]
  Para: [email protected]
    Cc:
  Data: Mon, 11 Jul 2005 11:16:47 -0500
Assunto: [Wicket-user] Spring Integration




Hi,

I'm looking into Wicket and would like to know what the preferred
method of integrating Wicket with Spring.  I'll need access to the
bean factory in the page classes.  I checked the wiki and didn't see
anything.  Thanks for the help.

-Nick


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




__________________________________________________________________________
UOL Fone: Fale com o Brasil e o Mundo com até 90% de economia.
http://www.uol.com.br/fone




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user





-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user


__________________________________________________________________________
UOL Fone: Fale com o Brasil e o Mundo com até 90% de economia.
http://www.uol.com.br/fone




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to