views:

39

answers:

1

Hi guys - one more wicket question :) I got a form and some text thats shown, after you submit the form. At the moment it does the following:

User1 types some text and submit the form -> get some result User2 enters the site and see the input from User1 -> has to delete the input and types his own -> get a new result ...

I think you get the problem, User2 should not see the input of User1! Additional I want to store the entered input for User1. So if he returns to the site he should be able to see his own data and nothing else!

I think I have to deal with sessions here - I heared Wicket is doing well with sessions, but I'm not able to get it working. I tryed something like that:

public class MainStartApplication extends WebApplication {
    @Override
    public Session newSession(final Request request, final Response response) {
        return new MySession(request);
    }

       @Override
       public Class<? extends WebPage> getHomePage() {
                MySession.get().setUserId(user);
       }
  }
public class MySession extends WebSession {
    private static final long   serialVersionUID    = 1L;
    private String              userId;

    public MySession(final Request request) {
        super(request);
    }

    public static MySession get() {
        return (MySession) WebSession.get();
    }

    public void setUserId(final String userId) {
        this.userId = userId;
    }

    public String getUserId() {
        return userId;
    }

}

But it doens't work. (No errors)

Maybe you can give me some hints? Thx a lot

Best regards Sylvus

P.S. Im working with Tomcat v6!

A: 

Wicket does a fair amount of session handling properly without you needing to muck with subclassing the WebApplication and WebSession.

It would be better if you posted the form and view code that's giving you trouble, and let us help diagnose the real issue.

There are of course situations where it's right to subclass these, but it's not clear to me that you've got that need.

If you in fact do need to do something in the session, exactly what you need to do will be clearer from the context of the base problem.

Don Roby

related questions