コンソールログに
気に
エラー内容
WARN [2016-05-28 10:45:55,930] org.apache.wicket.Localizer: Tried to retrieve a localized string for a component that has not yet been added to the page. This can sometimes lead to an invalid or no localized resource returned. Make sure you are not calling Component#getString() inside your Component's constructor. Offending component: [FooterPanel [Component id = footerPanel]]
Component
のComponent#getString()
をcall
すると、
ページクラスに
と
Stack Overflow
で
java - Calling getString() in constructor in Wicket gives error - Stack Overflow
対処方法
Panel
クラスのgetString()
メソッドを
onInitialize
メソッド内に
Before
public FooterPanel(String id) { super(id); add(new Label("sinceYear", getString("sinceYear"))); add(new Label("appName", getString("applicationName"))); add(new ExternalLink("authorLink", getString("authorLinkUrl"), getString("authorLinkLabelText"))); }
After
@Override protected void onInitialize() { super.onInitialize(); add(new Label("sinceYear", getString("sinceYear"))); add(new Label("appName", getString("applicationName"))); add(new ExternalLink("authorLink", getString("authorLinkUrl"), getString("authorLinkLabelText"))); }
以上です。
コメント