olá pessoal, eu estou criando um site de vendas básico, onde o usuário seleciona os produtos que quer na página catalogo.jsp e depois clica no botão finalizar, aí redireciona para a página comprar.jsp. Aí começam os problemas eu preciso pegar o valor das checkbox marcadas, pois se elas estiverem marcadas irão me retornar a ID do produto, e eu preciso dessa id pra buscar os dados no MySQL … espero ter explicado direitinho.
abaixo os códigos:
catalogo.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Avon Online ... Vendas, Clientes, e-Revendedoras ...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Nickname" content="Avon Online ... e-Revendedores" />
<meta name="Author" content="Bruno Cab" />
<meta name="Publisher" content="Avon Online" />
<meta name="Copyright" content="Copyright (c) Avon" />
<meta http-equiv="Content-Language" content="pt-br" />
<meta name="description" content="Avon Online, site que reúne tudo sobre a Avon entre clientes, vendas online, e muito mais ..." />
<link rel="home" title="Home" href="http://www.portalcab.com/"/>
<link rel="index" href="http://www.portalcab.com/" />
<link rel="stylesheet" href="http://www.portalcab.com/style-screen.css" type="text/css" media="screen" title="PortalCab Azul" />
<link rel="stylesheet" href="http://www.portalcab.com/foto.css" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="RSS Feed 2.0" href="http://feeds.feedburner.com/portalcab" />
<script type="text/javascript" src="http://www.portalcab.com/blog/lightbox.js"></script>
<script src="http://www.portalcab.com/favorito.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-124848-1";
urchinTracker();
</script>
</head>
<body class="home"><a name="top"></a>
<div id="lead"></div>
<div id="wrap">
<div id="head">
<!-- Links Cabeçalho -->
<img border="0" src="avon.JPG" alt="" width="200" height="35"/>
<p class="links"><a href="http://localhost:8084/avon/">Início</a> | <a href="http://localhost:8084/avon/contato.jsp">Contato</a>
<input type="hidden" name="client" value="pub-1566782502177931"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="[telefone removido]"></input>
<input type="hidden" name="ie" value="UTF-8"></input>
<input type="hidden" name="oe" value="UTF-8"></input>
<input type="hidden" name="cof" value="GALT:#7EABD7;GL:1;DIV:#FFFFFF;VLC:0066CC;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0066CC;LC:0066CC;T:000000;GFNT:7EABD7;GIMP:7EABD7;FORID:11"></input>
<input type="hidden" name="hl" value="pt"></input>
</form>
<hr class="hide" />
</div>
<!-- close #head -->
<!-- Links Barra Esquerda -->
<ul id="topics">
<p><a title="Início" href="http://localhost:8084/avon/">Início</a><br>
<small>Página inicial do site ...</small></p>
<p><a title="A Empresa" href="http://localhost:8084/avon/empresa.jsp">A Empresa</a>
<br>
<small>Informações sobre a Avon</small></p>
<p><a title="Cadastre-se" href="http://localhost:8084/avon/cadastro.jsp">Cadastre-se</a><br>
<small>Cadastre-se e tenha acesso a áreas exlusivas do site</small></p>
<p><a title="Login" href="http://localhost:8084/avon/login.jsp">Login</a><br>
<small>Faça login no site.</small></p>
<p><a title="Ofertas" href="http://localhost:8084/avon/catalogo.jsp">Ofertas</a><br>
<small>Confira as nossas ofertas para a campanha atual.</small></p>
</ul>
<!-- close #topics -->
<h1>Avon Online</h1>
<div id="cont">
<!-- Título -->
<h1>Título</h1>
<div id="cont">
<div class="post">
<!-- Imagem
<div class="imagempost2"><img border="0" src="LINK" alt="Título" width="542" height="716" /></div> -->
<!-- Texto -->
<table width="65%" border="0" cellpadding="0" cellspacing="2">
<!--
<tr>
<td colspan=9><img src="imagens/titulos/barra_ofertas.gif"></td>
</tr>
-->
<!-- Linha1 -->
<tbody>
<tr>
<td width="1"> </td>
</tr>
<tr>
<td width="1"> </td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="center" valign="top"><div align="center"><strong><font size="4">Kits
Presenteáveis para o Natal !!!</font></strong></div></td>
</tr>
<tr>
<td align="center" valign="top"> <form method="post" action="https://store.avon.com.br/avonstore/shopper_lookup.asp?" id="form2" name="form2">
<input name="target" value="xt_orderform_additem.asp" type="hidden">
<input name="retorno" value="dept.asp" type="hidden">
<input name="complemento" value="dept_id=7000" type="hidden">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td> <img src="natal_arquivos/9900102.jpg" alt="Produto Destaque" align="bottom" border="0"></td>
<td> <img src="natal_arquivos/branco.gif" align="bottom" border="0" height="2" width="5">
</td>
<td width="200"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="200"><br> <br> <div class="textopreto2">Estojo
Naturals Manga e Maracujá</div>
<br> <p> </p>
<div class="textovermelho2"> Lançamento !!!<br>
</div>
<br> <div class="textoazul2">R$ 19,99</div>
<br> </td>
</tr>
<tr>
<td> <table border="0" cellpadding="0" cellspacing="0">
</table></td>
</tr>
<tr>
<td width="150"> <input name="pf_id" value="9900102" type="hidden">
<input name="dept_id" value="7000" type="hidden">
<input name="volume" value="1395" type="hidden">
<a href="www.google.com.br"><img src="natal_arquivos/incluir.gif" width="58" height="30" border="0"></a>
<input name="ch[]" type="checkbox" id="ch[]" value="01">
</td>
</tr>
</tbody>
</table></td>
...
<input name="Input" type="submit" onClick="" href="http://localhost:8084/avon/comprar.jsp" value="Finalizar">
<br>
</a></div></td>
</tr>
</tbody>
</table>
<center>
</center>
<p> </p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td height="10" valign="top" width="50%"><div align="center"><span class="verdana10-7B61ADbt"><strong>Formas de Pagamento: </strong></span></div></td>
</tr>
<tr>
<td><div align="center"> </div></td>
</tr>
</tbody>
</table>
<p align="center"> </p>
</div>
</div>
</body>
</html>
e a página comprar.jsp
<%
//testando os checkboxes
String ch01=request.getParameter("ch01");
System.out.println(ch01);
String ch02=request.getParameter("ch02");
String ch03=request.getParameter("ch03");
String ch04=request.getParameter("ch04");
String ch05=request.getParameter("ch05");
String ch06=request.getParameter("ch06");
String ch07=request.getParameter("ch07");
String ch08=request.getParameter("ch08");
String ch09=request.getParameter("ch09");
String ch10=request.getParameter("ch10");
String ch11=request.getParameter("ch11");
String ch12=request.getParameter("ch12");
String ch13=request.getParameter("ch13");
String ch14=request.getParameter("ch14");
String ch15=request.getParameter("ch15");
String ch16=request.getParameter("ch16");
String ch17=request.getParameter("ch17");
String ch18=request.getParameter("ch18");
String ch19=request.getParameter("ch19");
String ch20=request.getParameter("ch20");
String ch21=request.getParameter("ch21");
String ch22=request.getParameter("ch22");
String ch23=request.getParameter("ch23");
String ch24=request.getParameter("ch24");
String ch25=request.getParameter("ch25");
String ch26=request.getParameter("ch26");
%>