Estou precisando de um botao para cada linha de uma tabela. Fiz com um for para ver se era do jeito que eu queria e vejo que é realmente, porém, desse jeito os botões ficam iguais em termo de funcionalidades.
Existe alguma possibilidade de fazer com que dentro de um for, os botoes tenham funcionalidades diferente?
Se não, como que poderia ser?
Alguém pode me ajudar?
<%@ page import="Produtos.*,java.util.*" language="java"
contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<!-- form action="carrinho.jsp" method="post">
Cursos:
<table border="1" cellpadding="10">
<tr>
<td><b>Nome</b>
<td><b>Descrição</b>
<td><b>Preço</b>
</tr>
</table>
<input type="submit" value="Carrinho">
</form-->
<h1>Cursos</h1>
<form action="carrinho.jsp" method="POST">
<table border="1" cellpadding="10">
<tr>
<td>Código
<td>Nome
<td>Preço
</tr>
<%
GerenteDeProduto gerenciador = new GerenteDeProduto();
List<Produto> produtos = gerenciador.carregarListaProdutos();
for (Produto p: produtos) {%>
<tr>
<td><%=p.getCodigo()%></td>
<td><%=p.getNome()%></td>
<td><%="R$ "+p.getPreco()%></td>
<td><input type="submit" value="Comprar" action="carrinho.jsp"/>
</tr>
<%
}
%>
</table>
</form>
</body>
</html>