THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
getRequestCycle().onRuntimeException(new MyErrorPage(), theException); |
To display errors
Normally all that is needed to display errors in a page is to call the "error" method in the WebPage:
Code Block |
---|
error("Message to the user indicating that an error occurred");
// alternative to get the message from a .properties file: error.login.user.invalid=${username} is not a valid user
error(new StringResourceModel("error.login.user.invalid", this, myUserModelThatHasAUsernameProperty).getString());
|
If an error occurred where the user needs to be directed to a different page we need to set the error on the session:
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);
|
How can I have images/files uploaded to and downloaded from my wicket app?
...