convertir servlet a jsp
Publicado por katherine (4 intervenciones) el 06/04/2013 21:02:37
tengo este servlet quisiera saber como puedo convertir en jsp :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
try {
HttpSession car = request.getSession(true);
if (request.getParameter("x")!=null){
int op = Integer.parseInt(request.getParameter("x"));
List<Carrito> alu = (List<Carrito>)car.getAttribute("pedido");
alu.remove(op);
}
List<Carrito> venta = (List<Carrito>)car.getAttribute("pedido");
out.println("<head><style type='text/css'>.fondo{color:white;background-color:black}</style></head>");
out.println("<table width=650 align=center border=1 cellspacing=0>");
out.println("<tr class='fondo'><th>Codigo<th>Producto<th>Precio<th>Unidades<th>Total<th> ");
int i=0;
for (Carrito item:venta){
out.println("<tr><td align=center>" + item.getCodigo()+
"<td>" + item.getProducto() +
"<td align=center>" + item.getPrecio() +
"<td align=center>" + item.getUnidades() +
"<td align=center>" + item.getPrecio()*item.getUnidades() +
"<td align=center><a href=sCart?x=" + i + ">Quitar</a>");
}
out.println("<tr><td colspan=6>Total de items : " + venta.size());
out.println("</table>");
} catch(Exception ex) {
out.println(ex);
}
}
Valora esta pregunta


0