Saturday, 6 April 2013

Generate Reports in jsp


if(sb.equals("Get Details.."))

{
%>
<html>
<body bgcolor="rgb(225,255,150)">
<center><h1>Customer Reports</h1></center>
<table border="1" bordercolor="red" align=center bgcolor="#525678" margin="1">

<tr >
<td>
<th bgcolor="silver"><h3>Cutomer Id</h3></th>
<th bgcolor="silver"><h3>Cutomer Name</h3></th>
<th bgcolor="silver"><h3>Cutomer Address</h3></th>
<th bgcolor="silver"><h3>Cutomer Email</h3></th>
<th bgcolor="silver"><h3>Cutomer Contact</h3></th>
<th bgcolor="silver"><h3>Select</h3></th>
<th bgcolor="silver"><h3>Edit</h3></th>
<th bgcolor="silver"><h3>Delete</h3></th>


<%
try
{
pst=con.prepareStatement("select * from customer order by customer_id");  
}
catch (SQLException ex)
{
out.println("Exception"+ex.getMessage());
}
   
rs=pst.executeQuery();
while(rs.next())
{


id=rs.getInt(1);
out.println(id);

HttpSession s12=request.getSession();
s12.setAttribute("name",id);

nm=rs.getString(2);
out.println(nm);
session.setAttribute("name",nm);
%>
<form action="edit.jsp" method="post" name="f1">
<tr><td></td>
<td><font color="" size="4"><%= rs.getInt(1)%></td>


<td><font color="" size="4"><%= rs.getString(2)%></td>

<td><font color="" size="4"><a href=<%= rs.getString(6)%>> <%= rs.getString(3)%></a></td>

<td><font color="" size="4"><%= rs.getString(4)%></td>

<td><font color="" size="4"><%= rs.getString(5)%></td>

<td><input type="checkbox" name="c1" value="<%=id %>" id="c1"></td>
<td><input type="submit" name="s1" value="Edit" onClick="return chek(this.form);"></td>
<td><a href="delete.jsp"><img src="img/delete1.png" height="40" width="40" ></a></td>
</tr>
</form>

<%
}

 %>
 </table>

 <%
  }

No comments:

Post a Comment