Send the code for HomePage.html and HomePage.html. It looks like you
declaring the label in the markup incongruent to your page hierarchy;
make sure it's in the wicket tag "menu".

Cheers,
JP.

On Thu, Aug 21, 2008 at 5:00 PM, btakacs <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I'm new in wicket. I tried to display a list of components, but I get the
> following error:
>
> WicketMessage: Unable to find component with id 'label' in [MarkupContainer
> [Component id = link, page = com.myapp.wicket.HomePage, path =
> 0:mainNavigation:menu:0:link.BookmarkablePageLink, isVisible = true,
> isVersioned = true]]. This means that you declared wicket:id=label in your
> markup, but that you either did not add the component to your page at all,
> or that the hierarchy does not match.
> [markup =
> file:/D:/workspace/NetBeansProjects/WicketTest/build/web/WEB-INF/classes/com/myapp/wicket/HeaderPanel.html
>
> The html:
> <html xmlns:wicket>
> <body>
>  <wicket:panel>
>    <h1>Wicket Example</h1>
>    <p id="titleblock">
>        Start of Example Title Goes Here
>
>   </p>
>
>   <ul wicket:id="menu">
>    <li>  </li>
>
>  </ul>
>
>  </wicket:panel>
> </body>
> </html>
>
> The MarkupComponents are:
> #       Path    Size    Type    Model Object
> 1       mainNavigation          3K      com.myapp.wicket.HeaderPanel          
>   No get
> method defined for class: class com.myapp.wicket.HomePage expression:
> mainNavigation
> 2       mainNavigation:exampleTitle     421 bytes
> org.apache.wicket.markup.html.basic.Label       wicket
> 3       mainNavigation:menu     4.4K
> org.apache.wicket.markup.html.list.ListView
> [EMAIL PROTECTED],
> [EMAIL PROTECTED],
> [EMAIL PROTECTED]
> 4       mainNavigation:menu:0           4.4K
> org.apache.wicket.markup.html.list.ListItem
> [EMAIL PROTECTED]
> 5       mainNavigation:menu:0:label     418 bytes
> org.apache.wicket.markup.html.basic.Label       First Page
> 6       mainNavigation:menu:0:link      1K
> org.apache.wicket.markup.html.link.BookmarkablePageLink         No get method
> defined for class: class com.myapp.wicket.HomePage expression: link
> 7       mainNavigation:menu:1           4.4K
> org.apache.wicket.markup.html.list.ListItem
> [EMAIL PROTECTED]
> 8       mainNavigation:menu:1:label     419 bytes
> org.apache.wicket.markup.html.basic.Label       Second Page
> 9       mainNavigation:menu:1:link      1K
> org.apache.wicket.markup.html.link.BookmarkablePageLink         No get method
> defined for class: class com.myapp.wicket.HomePage expression: link
> 10      mainNavigation:menu:2           4.4K
> org.apache.wicket.markup.html.list.ListItem
> [EMAIL PROTECTED]
> 11      mainNavigation:menu:2:label     418 bytes
> org.apache.wicket.markup.html.basic.Label       Third Page
> 12      mainNavigation:menu:2:link      1K
> org.apache.wicket.markup.html.link.BookmarkablePageLink         No get method
> defined for class: class com.myapp.wicket.HomePage expression: link
> 13      param           409 bytes       
> org.apache.wicket.markup.html.basic.Label
> 0
> 14      stylesheet      1.4K
> org.apache.wicket.markup.html.resources.StyleSheetReference     No get
> method defined for class: class com.myapp.wicket.HomePage expression:
> stylesheet
>
> I have the following classes:
>
> public class HeaderPanel{
>    public HeaderPanel(String componentName, String exampleTitle)
>    {
>        super(componentName);
>        add(new Label("exampleTitle", exampleTitle));
>        ArrayList<MenuModel> menu=new ArrayList<MenuModel>();
>        menu.add(new MenuModel("1", "HomePage", "First Page"));
>        menu.add(new MenuModel("2", "HomePage", "Second Page"));
>        menu.add(new MenuModel("3", "HomePage", "Third Page"));
>
>        MenuView view = new MenuView("menu", menu);
>        add(view);
>
>    }
> }
>
> public class MenuView extends ListView {
>
>    public MenuView(final String id) {
>        super(id);
>    }
>
>    public MenuView(final String id, final IModel model) {
>        super(id, model);
>    }
>
>    public MenuView(final String id, final List list) {
>        super(id, list);
>    }
>
>    @Override
>    protected void populateItem(ListItem item) {
>        final MenuModel element = (MenuModel) item.getModelObject();
>        Class clas;
>        try {
>            clas = Class.forName(element.getClas());
>        } catch (ClassNotFoundException ex) {
>            Logger.getLogger(MenuView.class.getName()).log(Level.WARNING,
> null, ex);
>            clas=this.getApplication().getHomePage();
>        }
>
>        item.add(new Label("label", element.getLabel()));
>        item.add(new BookmarkablePageLink("link", clas,
>                new PageParameters("id=" + element.getId())));
>    }
> }
>
> public class MenuModel implements Serializable{
>
>    public String clas;
>    public String label;
>    public String id;
>
>    public MenuModel(String id, String clas, String label){
>        this.id=id;
>        this.clas=clas;
>        this.label=label;
>    }
>
>    public String getClas() {
>        return clas;
>    }
>
>    public void setClas(String clas) {
>        this.clas = clas;
>    }
>
>    public String getLabel() {
>        return label;
>    }
>
>    public void setLabel(String label) {
>        this.label = label;
>    }
>
>    public String getId() {
>        return id;
>    }
>
>    public void setId(String id) {
>        this.id = id;
>    }
> }
>
>
> Any tips?
>
> Thanks.
> --
> View this message in context: 
> http://www.nabble.com/%22Unable-to-find-component-with-id%22-tp19091781p19091781.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to