Estou querendo fazer o seguinte:
Em uma página o usuário entra com o número de linhas e colunas da tabela, e em outra página aparece a tabela colunas x linhas, com um campo de entrada de texto em cada célula.
e qual sua dúvida mais especificamente?
Exemplo,essa tabela tem 2 colunas e 4 linhas,mas estou querendo fazer de jeito que o usuário entre com o número de linhas e colunas.
tá, mas o que você já conseguiu fazer?
Opa,
Tente algo nesse estilo:
String tabela = "<table>";
for(int i = 1; i <= 4; i++) { // Linhas
tabela += "<tr>";
for(int j = 1; j <= 3; j++) { // Colunas
tabela += "<td>";
tabela += "<input type=\"text\" name=\"textfield" + i + "-" + j + "\" />";
tabela += "</td>";
}
tabela += "</tr>";
}
tabela += "</table>";
Valeu
Valeu!
Consegui dessa forma
[code]
<%
int colunas= Integer.parseInt(request.getParameter(“colunas”));
int linhas= Integer.parseInt(request.getParameter(“linhas”));
%>
<table>
<tr>
<% for(int x = 1 ; x<= colunas;x++){%>
<th><input type="text"/></th>
<%}%>
</tr>
<% for(int x2=1 ;x2<=linhas -1;x2++){%>
<tr>
<%for(int x3 =1; x3<=colunas ;x3++){%>
<td><input type="text"/></td>
<%}%>
</tr>
<%}%>
</table>[/code]