Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

A child with id 'XXXX' already exist AND class constructor called twice issue

$
0
0
Hi everyone.

I am a little new on Wicket, and I have googling this problem a lot of time.

I have 3 or 4h try to solve this exception:
java.lang.IllegalArgumentException: A child with id 'eventos' already exists

But as you can see on code below, I am adding just a ListView component.

I ran this code step by step and I am noting that class constructor is
called twice. I don't know why, I am guess that the problem have to be with
that behaviour.

I am using wicket 6.7.0 on tomcat 7. Running on Windows 8.

Could you help me to solve this problem?

*This is the HTML code:*

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"

xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<wicket:head>
<link rel="stylesheet" type="text/css" href="tables.css"/>
<link rel="stylesheet" type="text/css" href="correos.css"/>
<link rel="stylesheet" type="text/css" href="ofertasPage.css"/>

</wicket:head>
<body>
<wicket:extend>
<div id="main">
<div id="leftside">
<div class="grupo">

Eventos

<wicket:link> Nueva evento <EventoPage.html>
</wicket:link>

Nombre
Tipo
Correo
Inicio de recepciꆧ⺵;n
Cierre de recepciꆧ⺵;n
Cierre de recepciꆧ⺵;n

Pedro Marcano
Pedro Marcano
0412/342-30-58
0412/342-30-58
0412/342-30-58

<images/preview-5.png>
<images/edit-9.png>

<wicket:link> Nuevo evento <EventoPage.html>
</wicket:link>
</div>
</div>
</div>
</wicket:extend>
</body>
</html>

*And this is the class constructor*

public EventosPage() {
LoadableDetachableModel<List;Evento>> ldm = new
LoadableDetachableModel<List;Evento>>() {
@Override
protected List<Evento> load() {
return Evento.getAll();

};

add(new ListView<Evento>("eventos", ldm) {

@Override
protected void populateItem(ListItem<Evento> item) {
Evento ev = item.getModelObject();

CompoundPropertyModel<Evento> cpm = new
CompoundPropertyModel<>(ev);

item.add(new Label("nombre", cpm));
item.add(new Label("tipo.nombre", cpm));
item.add(new Label("correo", cpm));
item.add(new Label("inicioRecepcion", cpm));
item.add(new Label("finRecepcion", cpm));

item.add(new BookmarkablePageLink("ver", EventoPage.class));
item.add(new BookmarkablePageLink("editar",
EventoPage.class));

});

Thanks in advance,
Roger

Viewing all articles
Browse latest Browse all 5648

Trending Articles