问题
I'm using "FeedbackLabels" to show component-specific validation messages, based on ideas and code in this blog post: User friendly form validation with Wicket.
Problem is, pages using such FeedbackLabels for validation messages flood the log with superfluous warnings:
2012-05-04 10:43:32,824 ["http-bio-8080"-exec-6] WARN org.apache.wicket.protocol.http.WebSession - Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Message: [FeedbackMessage message = "Tilille on pakollinen tieto", reporter = toAccount, level = ERROR]
2012-05-04 10:43:32,824 ["http-bio-8080"-exec-6] WARN org.apache.wicket.protocol.http.WebSession - Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Message: [FeedbackMessage message = "Tililtä on pakollinen tieto", reporter = fromAccount, level = ERROR]
2012-05-04 10:43:32,824 ["http-bio-8080"-exec-6] WARN org.apache.wicket.protocol.http.WebSession - Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Message: [FeedbackMessage message = "Viitenro on pakollinen tieto", reporter = reference, level = ERROR]
2012-05-04 10:43:35,039 ["http-bio-8080"-exec-6] WARN org.apache.wicket.protocol.http.WebSession - Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Message: [FeedbackMessage message = "Tilille on pakollinen tieto", reporter = toAccount, level = ERROR]
[...]
Wicket claims that:
Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page.
Thing is, as you can see in the screenshot, those messages were rendered (in the FeedbackLabels accompanying each field), and I do also have a FeedbackPanel on the page (but it filters the component-targetted messages, using ComponentFeedbackMessageFilter, so that they aren't shown twice).

In any case, these log messages clearly aren't useful. How can I make Wicket shut up about this? (Without resorting to brute force methods like changing logging level to FATAL.) Should something be fixed in Daan's FeedbackLabel implementation perhaps (see below)?
Appendix: Basically FeedbackLabel (extends Label) checks if the related component has a feedback message, and if so, displays it. If you can't be bothered loading the code from the article, here's the relevant part:
// (Author of this code is Daan, StuQ.nl
// it's licenced under Apache 2.0 license.)
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if(component.getFeedbackMessage()!=null) {
if(this.text!=null) {
setDefaultModel(this.text);
} else {
setDefaultModel(new Model(component.getFeedbackMessage().getMessage()));
}
this.add(new AttributeModifier("class", true, new Model("feedbackLabel " + component.getFeedbackMessage().getLevelAsString())));
} else {
setDefaultModel(new Model(""));
}
}
回答1:
FeedbackMessage has a markRendered() functon. I would add a call to this for each message that whas added to a Label. Seethe code of the FeedbackPanel.
来源:https://stackoverflow.com/questions/10445703/how-to-avoid-superfluous-wicket-log-warnings-when-using-field-specific-feedbackl