Any components on your Page that aren't stateless cause the Page containing
them to be Stateful- Forms are stateful by default. Add this to your
page's onInitialize() and it will help you see what's going on. Check out
Wicket's StatelessForm class.
@Override
protected void onInitialize()
{
super.onInitialize();
visitChildren( new IVisitor<Component, Void>()
{
@Override
public void component( Component component, IVisit<Void> visit )
{
if( component.isStateless() )
{
return;
}
log.warn( "Not Stateless: Component: " + component.getId() + " / " +
component.getMarkupId() + " - " + component.getPageRelativePath() );
}
} );
}
On Wed, Oct 2, 2013 at 5:05 PM, shimin_q <[email protected]> wrote:
> This could explain the intermittent nature of the problem. Thanks, Nick!
> Could you elaborate on what you mean by stateless login page? Here is my
> Login page and Login Form inside it. Could you please tell me what I need
> to change?
>
> public class HomePage extends WebPage {
>
> public HomePage() {
> add(new Label("headerMessage", "OmniVista 8770 Login"));
>
> add(new LoginForm("form"));
>
> add(new FeedbackPanel("feedback"));
> }
>
> }
>
> public class LoginForm extends Form<Login> {
>
> private static final Logger logger =
> LoggerFactory.getLogger(LoginForm.class);
>
> private static final long serialVersionUID = 1L;
>
> private TextField<String> username;
> private PasswordTextField password;
>
> public LoginForm(String id) {
> super(id, new CompoundPropertyModel<Login>(new Login()));
>
> username = new TextField<String>("username");
> username.setRequired(true);
> add(username);
> password = new PasswordTextField("password");
> add(password);
> }
>
> @Override
> protected void onSubmit() {
> Login login = getModelObject();
>
> AuthenticatedWebSession session =
> AuthenticatedWebSession.get();
> if (session.authenticate(login.getUsername(),
> login.getPassword())) {
> logger.debug("authentication successful");
> this.continueToOriginalDestination();
> }
> else {
> error("Invalid credentials");
> }
> }
>
> }
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661662.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>