Hello everybody,

I already tried to chat on ##wicket about this, but it's probably too
complex for IRC...

I'm using Wicket 1.3.0 snapshot and Spring 2.0 on JDK6 / Jetty. For a
more complex form I wanted to use a "stateful" Springbean, to which I
applied scope="prototype". The idea is to have one bean instance for
every Form instance. I would access the bean with PropertyModels and
direct method calls during construction (i.e. setting initial state
from input parameters) and during events, which would alter the state.
I inject the bean into the Form with @SpringBean annotation.

This works somehow, but sometimes, especially after using the
backbutton, I had the problem that the internal state was reset. So I
analyzed the stack in the constructor of the bean implementation, and
found out that it was called twice during construction of the Form.
First, during the super() call, and then again in the next line during
a method call on that bean. I appended both stacktraces below. The
proxy itself does not change.

This happens again after going back and e.g. submitting again. This
results in a NPE, because the internal state is reset.

I understand from reading the mailing list that the Wicket-Proxy does
nothing but a lookup in the Application context, and does not know or
care about spring scope.

And here I'm a little stuck. I am already considering to put the state
into the Form, and make the Bean a singleton without any internal
state. As that would mean some heavy refactoring, I would prefer a way
where the Spring acces would work as I want. Or is this a wrong way
altogether?

thanks in advance for any comments.

-- 
greetings from Berlin,

Rüdiger Schulz

www.2rue.de

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to