Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:06:34+00:00 2026-05-31T04:06:34+00:00

I am trying to implement Breadcrumb Navigation on a WebPage that exchanges a content

  • 0

I am trying to implement Breadcrumb Navigation on a WebPage that exchanges a content Panel via ajax.

It ends up looking like this:
Home >> Page >> Panel

Here is my page code:

public MyPage() {
    super();
    contentContainer = new WebMarkupContainer("contentContainer");
    contentContainer.setOutputMarkupId(true);
    add(contentContainer);
    contentContainer.add(content = createContentPanel());   

    breadCrumbContainer = new WebMarkupContainer("breadcrumbContainer");
    breadCrumbContainer.setOutputMarkupId(true);
    add(breadCrumbContainer);   

    final AjaxLink panelLink = new AjaxLink("panelLink") {

        @Override
        public void onClick(final AjaxRequestTarget target) {
            replaceContentPanel(getOverviewPanel(), target);
        }

        @Override
        public boolean isVisible() {
            return !(content instanceof OverviewPanel);
        }
    };
    breadCrumbContainer.add(panelLink);
    panelLink.add(new Label("panelLabel", new Model<String>() {
        @Override
        public String getObject() {
            //some dynamic content for example:
            return contentPanel.getClass().getName();
        }
    }));  
}

public void replaceContentPanel(final Component replacer, final AjaxRequestTarget target) {
    content.replaceWith(replacer);
    content = replacer;
     if (target != null) {           
        target.add(contentContainer);
        target.add(breadCrumbContainer);
    }
}

The Home and Page Label are easy. The one for Panel needs to be updated everytime I updated the content Panel of the WebPage. I was sure that the target.add(breadCrumbContainer); line was going to do this. However it is empty. The Label shows nothing.

I was hoping to find the answer – which is probably obvious – while writing up the question, but it still eludes me, so I am hoping someone here spots my mistake.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:06:36+00:00Added an answer on May 31, 2026 at 4:06 am

    When playing with a component’s visibility through Ajax, it’s necessary to use setOutputMarkupPlaceholderTag(true), in addition to setOutputMarkupId(true). Notice that setOutputMarkupPlaceholderTag(true) will automatically imply setOutputMarkupId(true).

    The reasons to do so are that when a component gets refreshed through Ajax (adding it to the AjaxRequestTarget), Wicket returns the refreshed markup in the Ajax response, so that it will be replaced via JS-DOM API through the Ajax callback method. So, for the JS function that will replace the received markup to work, it’s necessary to have a reference to the DOM node to replace (an HTML id attribute). That’s why setOutputMarkupId(true) is needed.

    When changing visibility, if the component is non-visible, Wicket will not generate any markup for the component, which is great, but has a drawback. If an invisible component turns out to be visible in a following ajax request, its markup will be effectively returned in the Ajax response. But, since the component was not visible, it will not even exist in the original markup, and it will be impossible to replace the DOM node at callback time. That’s where the setOutputMarkupPlaceholderTag(true) method enters into action, wrapping the maybe-not-visible component in a placeholder tag (i.e. a <div>), that will always be rendered with the proper HTML id attribute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to implement an autocomplete based on this It looks like it's very straight
when trying to implement an Aspect, that is responsible for catching and logging a
Trying to implement some nested loops that are spitting out good old nested html
Trying to implement a function that will return a list of ints the represent
SetFocus I'm trying implement the above Se Focus code in a Class Library that
Trying to implement this gallery on my website. http://coffeescripter.com/code/ad-gallery/ It is noted in the
Trying to implement a simple notification system based on private pub ( something like
Trying to implement a shell, mainly piping. I've written this test case which I
Trying to implement a MSMQ-backed WCF PubSub. I understand that net.msmq is one-way; however
When trying to implement a simple OpenGL application, I was surprised that while it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.