Note that there are some explanatory texts on larger screens.

plurals
  1. POFragment inside a ListView - Wicket
    text
    copied!<p>I'm trying to add fragment inside a repeating li component:</p> <pre><code>&lt;ul&gt; &lt;li wicket:id="listView"&gt;HERE GOES MY FRAGMENT&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The code to populate the listview is the following:</p> <pre><code>@Override protected void populateItem(final org.apache.wicket.markup.repeater.Item&lt;Message&gt; item) { Message msg = item.getModelObject(); log.info("Adding message fragment to markup: " + item.getMarkupId()); item.add(new MessageFragement(item.getMarkupId(), "messageFragment", this, msg)); } </code></pre> <p>The generated expected code is:</p> <pre><code>&lt;ul&gt; &lt;li .... wicket:id="listView&gt;&lt;/li&gt; &lt;li .... wicket:id="listView&gt;&lt;/li&gt; .... &lt;/ul&gt; </code></pre> <p>But my fragment is not added and I receive the Runtime wicket exception:</p> <blockquote> <p>The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered).</p> </blockquote> <p>Why I cannot use the item markup id as componenent id for my fragment? I now this can be easily solved by adding an additional tag on the li:</p> <pre><code>&lt;ul&gt;&lt;li wicket:id="listView"&gt;&lt;div wicket:id="message"&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt; </code></pre> <p>And add the markup id "message" to the fragment. But I don't want it. I just want to use the already there &lt;li&gt; to host my fragment, is it even possible?</p> <p>Thanks guys</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload