Hey all,

I am quite new to Wicket, but I am trying some stuff to see how it works. Right 
now I am trying my best to build a little database-designer, but I get a 
MarkupException, but I dunno why. I am using MarkupInheritance ...
My Code doesn't look very tidy, but I am still brave enough to post it. Hope 
someone sees where it fails. Thank you in advance!

My first class-file, where it calls the second class-file, that includes the 
code, that will be loaded into the original html-file:
-------------------------------------------------------------------------
// DBDesigner.java:
protected void onSubmit(){
        String o = ( String ) drop3.getObject();
        if( o.equals( "Datensaetze nur anzeigen" )){
                try{
                        String tab = tableList.get( tabelle );
                        /* RESPONSEPAGE CALLED HERE!!!!*/
                        ListTabelle listing = new ListTabelle( tab );
                        setResponsePage( listing );
                }
                catch(Exception e){
                        System.out.println( "TIENES UNA PROBLEMA: " + e );
                }
        }
}
--------------------------------------------------------------------------


It calls ListTabelle.java where I load data from a database according to the 
choice of the user (the user chooses a table to collect to data from). I build 
up a RepeatingView that holds the data.
I tried to just print the data in a label for shit and giggles and it worked, 
but something doesn't work with my RepeatingView (or with all the other 
Components I tried ...). I am missing something and tried for days now to 
figure out where my brain fails ... I just can't see it.
Here is the code from ListTabelle.java (at least, what could be interesting):
--------------------------------------------------------------------------
package ...;
import ...;


public class ListTabelle extends DBDesigner implements Serializable{
        
        // VARIABLES ... 
        
  /**
   * Constructor
   * @param conMe
   * @param tab
   */
  public ListTabelle( String tab ){
        this.tab = tab;
        
        try {
                        
                /*
                 *  CONNECTION TO DB:
                 */
                ...
                                
              try{
                        showData();
                                        
                        int sizeH = tabellenHeader.size();
                        int sizeC = list.size();
                                        
                        RepeatingView heading = new RepeatingView( "heading" );
                        for( int i = 0; i <= sizeH; i++ ){
                          heading.add( new Label( heading.newChildId(),
                                                           tabellenHeader.get( 
i ) ) );
                        }
                        add( heading );
                        RepeatingView row = new RepeatingView( "row" );
                        add( row );
                                        
                        for( int j = 0; j <= sizeC; j++ ){
                          WebMarkupContainer r = new WebMarkupContainer( 
                                                                        
row.newChildId() );
                          RepeatingView cell = new RepeatingView( "cell" );
                          row.add(r);
                          r.add(cell);
                          cell.add( new Label( cell.newChildId(), 
                                                        list.get( j ) ) )       
                                          for( int d = 0; d <= sizeC; d++ ){
                             cell.add( new Label( cell.newChildId(), 
                                                          list.get( j )  ) );
                          }
                        }

                        

                        /* 
                         * close the database 
                         */
                        conMe.close();
                    } 
                    catch( Exception e ){
                        e.printStackTrace();
                    }
        }
        
        
        /**
         * Bastelt die Ausgabe-Liste aus der Datenbank zusammen.
         */
        private void showData(){

                add( new Label( "infoText", "Ihre Daten werden angezeigt!" ) );
                
                list = new ArrayList<String>();
                tabellenHeader = new ArrayList<String>();
                try {
                        Statement cs = conMe.createStatement();
                        // Tabellen-Header abfragen:
                        ResultSet header = cs.executeQuery( 
                                                "SHOW COLUMNS FROM " + tab + 
";" );
                        anzahlSpalten = 0;
                        while( header.next() ){
                        anzahlSpalten++;
                        tabellenHeader.add( inhalt );
                        list.add( inhalt );
                }
                        
            // Tabellen-Inhalt:
            ResultSet tcontent = cs.executeQuery( 
                                                "SELECT * FROM " + tab + ";" );
            // tcontent.next() - ist immer die neue Zeile, die dann 
            // spaltenweise ausgelesen werden kann.
            while( tcontent.next() ){
                for( int i = 0; i < anzahlSpalten; i++ ){
                        list.add( tcontent.getString( 
                                                        tabellenHeader.get(i)));
                }
            }
                
            System.out.println("Die ausgelesenen Daten: \n" + test);
            
            
        } 
        catch( SQLException e ){
                System.out.println( "Fehler SQL-Befehl: " + e );
        }
        }
}
--------------------------------------------------------------------------


I put <wicket:child></wicket:child> into my DBDesigner.html-File and my 
ListTabelle.html looks like this:
--------------------------------------------------------------------------
<wicket:extend>
        <div wicket:id="infoText"></div> 
        <table>
                <tr>
                        <th wicket:id="heading">
                        </th>
                </tr>
                <tr wicket:id="row">
                        <td wicket:id="cell">
                        </td>
                </tr> 
        </table>
</wicket:extend>
--------------------------------------------------------------------------

I know this is a lot to read right now, but please bear with me ... I am just a 
baby-wicket-nerd and I am really desperate! I bet it is just a simple little 
thing, like - I dunno - a quotation mark ... 
I hope someone can help me.
Thnx in advance again :)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to