aauser
asked on
servlet dynamically add/drop a column from table
Hi,
I can add or drop a column in my table,
but how can I make it so that it dynamically
update on how to display the total column
from the table:
ex: Let says currently have a table with three columns;
if I add one more column, how can I write a loop
so that it prints out four columns; and if I delete
one column, how can I write a loop so that i prints
out 2 columns with headings ,headings can be the name of the colums, (when I select to query database).
String col1 = "Name";
String col2 = "phone";
String col3 = "email";
out.println("<TD>"+col1+"< TD>"+col2+ "<TD>"+col 3");
while (rset.next ()) {
out.println("<TR>");
for (int i=1;i<=3;i++) {
out.println("<TD>"+rset.ge tString
(i));
}
====
html file:
Column Name:<INPUT type=text name="newcolumn">
thanks in advance:
I can add or drop a column in my table,
but how can I make it so that it dynamically
update on how to display the total column
from the table:
ex: Let says currently have a table with three columns;
if I add one more column, how can I write a loop
so that it prints out four columns; and if I delete
one column, how can I write a loop so that i prints
out 2 columns with headings ,headings can be the name of the colums, (when I select to query database).
String col1 = "Name";
String col2 = "phone";
String col3 = "email";
out.println("<TD>"+col1+"<
while (rset.next ()) {
out.println("<TR>");
for (int i=1;i<=3;i++) {
out.println("<TD>"+rset.ge
(i));
}
====
html file:
Column Name:<INPUT type=text name="newcolumn">
thanks in advance:
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You need to maintain a list of required columns in the session, and use this list when constructing query and resulting table.