I'm trying to nest a Label within a Link so the name of the link displayed is dynamic (please fill me in if there's a better way.)

Here's my Link & Label on the page:

<a href="" wicket:id="link"><span wicket:id="linkName">link</span></a>

Here's the panel class:

public class TrailPanel extends Panel
{
    public TrailPanel(String id, String linkName)
    {
        super(id);
       
        //create link w/ event handler
        Link currentLink = new Link("link")
        {
            public void onClick()
            {
                //redirect
                setResponsePage(getPage());
            }
        };       
       
        //add link to page
        add(currentLink);
        add(new Label("linkName", linkName));
    }
}

I'm getting this exception, which makes sense..just don't know how to fix it:

wicket.markup.MarkupException: Unable to find component with id 'linkName' in [MarkupContainer [Component id = link, page = com.myapp.ui.admin.EditProduct, path = 1:trailPanel:link.TrailPanel$1, isVisible = true, isVersioned = true]]. This means that you declared wicket:id=linkName in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match

Don't shoot the n00b!!

Reply via email to