The pages are serialized because that is how wicket keeps state - by
serializing the pages into session. To avoid serializing the whole container
you need to be careful to declare your bean properties as transient, and
then have a mechanism to reget them from the container. To avoid this I
never store references to the beans inside volatile objects such as
components and pages. Another problem with using a spring-aware page factory
is that you can no longer do something like this:

setResponsePage(new EditCustomerPage(customerId));

Instead I use the following pattern:
The webapplication subclass is created inside spring as a contextaware bean
via an implementation of a iwebapplicationfactory. Then in my pages when I
need a dao I add the following function:

Class MyPage extends WebPage {

        MyDao getMyDao() {
        
((MyApplicationSubclass)getApplication()).getContext().getBean("mydao");
        }

        MyDao2 getMyDao2() {
                // more widely used beans get injected into the application
subclass to save lookups
                ((MyApplicationSubclass)getApplication().getMyDao2();
        }
}
 
It works quite well for me.

-Igor


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Cameron Taggart
> Sent: Sunday, September 04, 2005 9:07 PM
> To: [email protected]
> Subject: Re: Re: Re: [Wicket-user] Spring Integration
> 
> I found out about Wicket at the web framework smackdown at JavaOne. 
> I've been poking around the documentation and mailing list 
> since then, but I'm truly evaluating Wicket this week.  I've 
> customized a couple of the examples and like what I see so 
> far very much!
> 
> Spring integration is a requirement for me and the company I work for.
>  Were using Hibernate and injecting the DAO's into services (business
> logic) layer.  We use Spring MVC and the services are 
> injected into the Spring MVC controllers.  I'm trying to 
> figure out what I would inject the services into within the 
> wild Wicket world.  Any suggestions?
> 
> I've been thinking that I would inject the services into the 
> Page's and just create a SpringPageFactory.  That seams easy 
> enough, but the part that is troubling me is "there is a big 
> problem with injection.
> Pages get serialized."  Now I need to learn more about Wicket 
> to find out why pages are being serialized.  More importan, 
> what is doing the deserialization?  What would it take to 
> reinject those services when the pages are deserialized?
> 
> I've worked with Spring quite a bit and can probably help out 
> on that front, but I just need to learn more about Wicket in 
> order to contribute.
> 
> Cameron
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & 
> EXPO September 19-22, 2005 * San Francisco, CA * Development 
> Lifecycle Practices Agile & Plan-Driven Development * 
> Managing Projects & Teams * Testing & QA Security * Process 
> Improvement & Measurement * http://www.sqe.com/bsce5sf 
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 
> 




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to