Hi, I get the following warning message when trying to retrieve a localized string: *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*
This how my code look like: public class NavigationBarPanel extends Panel { private static final long serialVersionUID = 1L; /** The navigation bar links */ private final String MENU_MENU = new StringResourceModel("navigationbar.menu.home", this, null).getString(); private final String NUMBER_POOL_MENU = new StringResourceModel("navigationbar.menu.numberpool", this, null).getString(); private final String NUMBER_POOL_LOG_MENU = new StringResourceModel("navigationbar.menu.numberpoollog", this, null).getString(); private final String DEFRAGMENT_MENU = new StringResourceModel("navigationbar.menu.defragment", this, null).getString(); private final String SEARCH_MENU = new StringResourceModel("navigationbar.menu.search", this, null).getString(); public NavigationBarPanel(String id) { super(id); addLinks(); } private void addLinks() { addLink("home", MENU_MENU, HomePage.class); addLink("numberPool", NUMBER_POOL_MENU, NumberPoolPage.class); addLink("numberPoolLog", NUMBER_POOL_LOG_MENU, NumberPoolLogPage.class); addLink("defragment", DEFRAGMENT_MENU, DefragmentPage.class); addLink("search", SEARCH_MENU, SearchPage.class); } private void addLink(String id, String title, final Class<? extends Page> pageClass) { BookmarkablePageLink link = new BookmarkablePageLink(id, pageClass); link.add(new AttributeModifier("class", true, new AbstractReadOnlyModel() { private static final long serialVersionUID = 1L; @Override public Object getObject() { String currentPageName = pageClass.getName(); String parentPageName = getPage().getClass().getName(); return StringUtils.equals(currentPageName, parentPageName) ? "current_page_item" : AttributeModifier.VALUELESS_ATTRIBUTE_REMOVE; } })); link.add(new Label("title", new Model(title))); add(link); } } Could you please tell me why am I getting this warning. I use the same strategy to add localized string to my pages but I don't get warnings. Gr. Azzeddine