One warning don't do this:

@SecuredWicketPage public class EditAccountPage extends Template{
    private String repeatedPassword;

    @SpringBean   
    private AccountService accountService = null;

    public EditAccountPage() {
        Form form = new Form("form", new CompoundPropertyModel(this)) {

(the = null)

Because then youre accountService will be null again when the page is fully constructed.

johan



On 3/20/06, karthik Guru <[EMAIL PROTECTED]> wrote:
> Spring support for injecting your business logic into your web pages in a non-intrusive manner, while still being able to use the
> convenient Wicket idiom for creating pages (using the Java
new operator).

Yes - this one is my favourite! . ..actually even IAuthorizationStrategy and Ajax support rocks.!..now am not sure which is the best 1.2 feature. May be we s'd have a vote :)

You can inject spring-ified objects into your page / components just by specifying an annotation @SpringBean. Then wicket-spring module takes care of resolving all those dependencies when the component is instantiated.
It does it by using the cool 1.2 feature that allows you to register as many IComponentInstantiationListener as you want.
These listeners get called when the component is instantiated.

wicket-spring registers a IComponentInstantiationListener that runs through your page/components looking for fields that require injecttion (the ones that have @SpringBean specified) and resolves them through Spring's ApplicationContext.

So you just do this -

@SecuredWicketPage public class EditAccountPage extends Template{
    private String repeatedPassword;

    @SpringBean   
    private AccountService accountService;

    public EditAccountPage() {
        Form form = new Form("form", new CompoundPropertyModel(this)) {



and by the time you actually get to use accountService, wicket w'd have already resolved it for you with the help of Spring...and as you can see its all non-intrusive (yeah as long as you are ok with specifying @SpringBean :)) )

wicket team rocks!! - and in this case igor & eelco.. ..great job!




On 3/20/06, Tom van Zummeren <[EMAIL PROTECTED]> wrote:

I was wondering if there are any examples yet of new features in Wicket 1.2

 

Because on the wicket site I saw a list of new features in Wicket 1.2, but it didn't say how the new features are implemented.

In this case I'd like to know the following:

 

Spring support for injecting your business logic into your web pages in a non-intrusive manner, while still being able to use the convenient Wicket idiom for creating pages (using the Java new operator).

 

What is this non-intrusive manner?

 

 

Tom


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.5/284 - Release Date: 3/17/2006




--
-- karthik --

Reply via email to