Hello,

I would like to know where I could find documentation on the issue of
serializing objects inherited from a component's container as in the example
below. I tried looking at the wicket source code to see when this occurs but
still don't understand when/how it is done.

//...

final Product p = //get non-serializable Product object

add new Link( "addToCart") {
    public void onClick() {
        getSession().getCart().add( p.getId());
    //..etc

The above throws a NotSerializableException. However, no problem occurs
after the code is changed to:

//...

//Product p already assigned
final String pId = p.getId() //serializable

add new Link( "addToCart") {
    public void onClick() {
        getSession().getCart().add( pId);
    //..etc

(Also, building the Link with a wrapping Model object also works, obviously)

However I am curious to know why a non-model object is serialized when
inherited from the container even though within the same request?

Thanks for any comment,

JF

Reply via email to