I have a similar function where I allow the user to view the contents of
various DB tables in my system.  My process works like this:

1)  I build a collection of the column names that will be shown.

2)  I then extract the values for each row from the ResultSet using the
collection of column names and put those values into a collection.  I end
up with a collection (rows) of collections (column data in row).

3)  You can then put the collection of column names and the collection of
rows wherever you want them (a form or into context).

4)  Your JSP then processes the three collections:
      Iterate through the collection of column names for the table headings
      Iterate through the collection of Rows to build each row in your
table
            Iterate through each Row collection to each column for the row.

<tr>
  <logic:iterate name="columnNames" id="columnName">
    <td><bean:write name="columnName"/></td>
  </logic:iterate>
</tr>

<logic:iterate name="dataRows" id="row">
  <tr>
    <logic:iterate name="row" id="columnData">
      <td><bean:write name="columnData"/></td>
    </logic:iterate>
  </tr>
</logic:iterate>

Hope this helps...
Nick



                                                                                       
                                                    
                      "Mehta, Chirag (IT)"                                             
                                                    
                      <[EMAIL PROTECTED]        To:       <[EMAIL PROTECTED]>          
                                    
                      tanley.com>                  cc:                                 
                                                    
                                                   Subject:  Dynamically generating 
Action Forms                                           
                      08/14/2003 07:07 AM                                              
                                                    
                      Please respond to                                                
                                                    
                      "Struts Users Mailing                                            
                                                    
                      List"                                                            
                                                    
                                                                                       
                                                    
                                                                                       
                                                    




Hello,

Does anyone know if there is a way of generating an Action form from the
resultset's column metadata?

I have a jsp that allows the user to enter SQL statements. I do not know
what thier query will be so from the resultset I would like to create
action forms according to the columns to use to display their results?

Anyone have any clue?

Cheers

Chirag




--
NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to