Frank van Lankvelt wrote:
ok, I'll go ahead with storing the object in the session directly (as
meta-data) and use models in the pages to access this object.
May I ask what your use case is?

it's very simple; when carrying out an action on page A, I want to
display a modal window ("are you sure?" with ok/cancel).  The modal
window creates a separate page, B, with the label and the buttons.

The information (a boolean) about what option was chosen determines what
to do on page A when the modal window is closed.

cheers, Frank

Ok, that definitely seems like something you should *not* be using the session for. I'd think that's what you normally use a callback for, but unfortunately I don't know how in Wicket (not without using shared state), because for example, the onClose() method does not pass you the contents of the ModalWindow...

I mean, you could do something like this if the contents were given back to you:

        modal1.setWindowClosedCallback(new ModalWindow.WindowClosedCallback()
        {
            // Hypothetical callback with extra contents argument...
public void onClose(Component modalWindowPage, AjaxRequestTarget target)
            {
                boolean myBoolean = myModalWindowPage.getResult();
                // do whatever with the result...
                target.addComponent(result);
            }
        });

When I look at the Wicket examples for ModalWindow there is actually shared state passed between pages (i.e., the page with the modal window is passed as a parameter to the page IN the modal window). The modal window page then calls methods (setResult(...)) to change the state on the page that opened the modal window....

I'm wondering now if this is safe in combination with serialization, if so, why, and if not, what is the proper way to do this, because via the session is awful.

Regards,
Sebastiaan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to