You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by rpalacios <ro...@gmail.com> on 2013/06/01 21:54:00 UTC

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

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&oacute;n
                                	Cierre de recepci&oacute;n
                                	Cierre de recepci&oacute;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&lt;Evento>> ldm = new
LoadableDetachableModel<List&lt;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



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/A-child-with-id-XXXX-already-exist-AND-class-constructor-called-twice-issue-tp4659200.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


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

Posted by Paul Bors <pa...@bors.ws>.
See the Wicket free guide section section 11.2 Component ListView
http://wicket.apache.org/learn/books/freeguide.html

I also don't see your HTML markup for the wicket:id="eventos" so I'm not
sure how you got to add it at least once?



-----
~ Thank you,
    Paul@Bors.ws
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/A-child-with-id-XXXX-already-exist-AND-class-constructor-called-twice-issue-tp4659200p4659249.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org