I have a page with AjaxFallbackButton on it. On RuntimeException, I want to
show some error message in the feedbackpanel on the page. For testing, I
use this one page and one form and the following code in my WebApplication
to try:
@Override public RequestCycle newRequestCycle(Request request, Response
response) {
return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
response) {
@Override public Page onRuntimeException(Page page,
RuntimeException e) {
Form f = (Form) page.get("form");
f.error("An error (see below) has occured, we cannot go
on.");
f.error(e.getCause() == null ? e.getMessage() : e.getCause
().getMessage());
return page;
}
};
}
First, is this the correct way to handle RuntimeException in general. How
about Ajax? How can I Ajax update my page without sending back a new page?
Second, this only works with js disable. With js enable, the FeedbackPanel
is empty. What is wrong?