Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
getRequestCycle().onRuntimeException(new MyErrorPage(), theException);

How do I add/display errors

...

?

Normally all that is needed to display errors in a page is to call the "error" method in the WebPage:

...

Code Block
getSession().error(message);
throw new RestartResponseException(MyErrorPage.class, optionalPageParameters);

// it may be tempting to do the following, but it should not be done:
// error(message);
// setResponsePage(MyErrorPage.class);

To display an error (or any message for that matter: info/warning) in an HTML page use a FeedbackPanel:

Code Block

<!-- In the HTML page -->
<div wicket:id="feedback">[Feedback Panel]</div>

// In WebPage
add(new FeedbackPanel("feedback"));

// TODO : add example that adds error messages to individual form components of the page

I get 'Internal error cloning object' errors

...