Wicket - can you specify markups IDs for elements inside repeaters?

If you make your own ListView implementation, and then in the populateItem(final ListItem listItem) method, on that respective listItem you do.

If you make your own ListView implementation, and then in the populateItem(final ListItem listItem) method, on that respective listItem you do: listItem. SetOutputMarkupId(true); // write id attribute of element to html listItem. SetMarkupId("id"+i); where I is some index you initialize in the ListView's constructor or something?

1 ListItem has method #getIndex() – martin-g Nov 17 '11 at 6:36.

As Andrei told that its possible but dangerous. SetMarkupId doc: Retrieves id by which this component is represented within the markup. This is either the id attribute set explicitly via a call to org.apache.wicket.Component.

SetMarkupId(java.lang. String), id attribute defined in the markup, or an automatically generated id - in that order. If no explicit id is set this function will generate an id value that will be unique in the page.

This is the preferred way as there is no chance of id collision. kiwidoc.com/java/l/p/org.apache.wicket/w... and also you cant get the markup id with getMarkupId().

1 That's a good point, however I think that creating somekind of global (or even idividual per element type) sequencer (using AtomicInteger for instance) could take care of the uniqueness of the id. The issue with the Wicket generated one is that it changes each time the app/page are reloaded, which makes it a nightmare for automated functional testing. – Andrei Bodnarescu Nov 17 '11 at 7:10.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions