I have narrowed the behaviour that prevents our MyExpiredPage appearing
to this code below, specifically the StringEqualsValidator.

                captchaToken = new
RequiredTextField<String>("captchaToken", 
                        new PropertyModel<String>(this,
"captchaEntered"))
                        {
                            @Override
                            protected final void onComponentTag(final
ComponentTag tag)
                            {
                                
                                super.onComponentTag(tag);
                                // clear the field after each render
                                if ( captchaToken.hasErrorMessage() ) {
                                    tag.put("value", "");
                                }
                            }
                        };
                 captchaToken.add(new StringEqualsValidator(
captcha.getAnswer() ));


public class StringEqualsValidator implements IValidator<String> {
 
        private final String toCompare;
        
        public StringEqualsValidator(String str) {
                toCompare = str;
        }
 
        @Override
        public void validate(IValidatable<String> validatable) {
                final String input = validatable.getValue();
                
                if (StringUtils.equals(input, toCompare) == false) {
                        error(validatable, "notequal");
                }
        }
 
        private void error(IValidatable<String> validatable, String
errorKey) {
                ValidationError error = new ValidationError();
                error.addMessageKey(getClass().getSimpleName() + "." +
errorKey);
                validatable.error(error);
        }
 
}

> -----Original Message-----
> From: Dale Ogilvie [mailto:dale_ogil...@trimble.com]
> Sent: Wednesday, 30 May 2012 9:52 a.m.
> To: users@wicket.apache.org
> Subject: Specified expiration page not being shown
> 
> Hi,
> 
> This is for wicket 1.4.20.
> 
> In our WebApplication subclass we have used:
> 
> getApplicationSettings().setPageExpiredErrorPage(MyExpiredPage.class);
> 
> However after session has expired on one of our pages, if I submit the
(fairly
> complex) form, the form error message is shown. By this I mean that
page
> component validation fires and validation of an object from session
(now
> defunct) fails and the page is redrawn with an error message in the
feedback
> panel. The expired page IS displayed if an ajax backed combo is used
on the
> same form, only form submission avoids the expiry page.
> 
> Why might it be that our MyExpiredPage is not being shown in the form
> submission case? We want our expired page to be displayed
consistently.
> 
> Thanks for any suggestions as to where to look for the issue.
> 
> Dale
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to