Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page import="javax.swing.ImageIcon"%>
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <%@page import ="java.sql.*" %>
- <%@page import="java.io.*" %>
- <%@ page import="java.util.*" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/product.css" />
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Product</title>
- </head>
- <body>
- <div class="nav">
- <div id="contactBox">
- <form method="post" action="showSearch.jsp">
- <input type="text" name="searching" id="search"/><input type="submit" name="look" value="Search" id="searchButton"/>
- </form>
- </div>
- <img src="indica.PNG" alt="indica" width="500" height="90" id="indi"/>
- <div id="single">
- <ul>
- <li><a href="HomePage.jsp" class="home">HOME</a></li>
- <li><a href="Product.jsp" class="product">PRODUCT</a></li>
- <li><a href="" class="contact">CONTACT</a></li>
- <li><a href="" class="cart">CART</a></li>
- <li><a href="login.jsp" class="login">LOGIN</a></li>
- </ul>
- </div>
- </div>
- <div id="selection">
- <form method="post" action="Product.jsp">
- <img src="name.PNG" alt="indica" width="270" height="100" id="brand"/>
- <div id="buttons">
- <input type="submit" value="Men" name="btn" class="but"/><br>
- <input type="submit" value="Women" name="btn" class="but"/><br>
- <input type="submit" value="Brand" name="btn" class="but"/><br>
- <input type="submit" value="CashManager" name="btn" class="but"/><br>
- <input type="submit" value="Trend" name="btn" class="but"/><br>
- <input type="submit" value="Sale" name="btn" class="but"/><br>
- <input type="hidden" name="submitted" value="true"/>
- </div>
- </form>
- </div>
- <div id="wall">
- <%
- String url="jdbc:mySql://localhost/indica";
- String login="root";
- String password="";
- Class.forName("com.mysql.jdbc.Driver");
- Connection con=DriverManager.getConnection(url,login,password);
- Boolean submitted=Boolean.parseBoolean(request.getParameter("submitted"));
- if (submitted){
- String type=request.getParameter("btn");
- ResultSet rs = null;
- ResultSet res =null;
- PreparedStatement pStart = null;
- PreparedStatement pShow = null;
- //OutputStream img;
- Blob imgs ;
- byte[] imgDatas = null ;
- byte[] imgData = null ;
- try{
- pStart = con.prepareStatement("SELECT * FROM sunglasses WHERE Gender=?");
- pStart.setString(1, type);
- rs=pStart.executeQuery();
- ArrayList id=new ArrayList();
- while(rs.next()){
- String strprodvalue = rs.getString("id");
- id.add(strprodvalue);
- }
- for (int i = 0; i < id.size(); i++) {
- String ids=(String)id.get(i);
- Blob image = null;
- pShow = con.prepareStatement("SELECT * FROM sunglasses WHERE id=?");
- pShow.setString(1, ids);
- res=pShow.executeQuery();
- while(res.next()){
- Blob bl =res.getBlob("image");
- byte[] pict = bl.getBytes(1,(int)bl.length());
- response.setContentType("image/jpg");
- OutputStream o = response.getOutputStream();
- %>
- <TABLE BORDER="1">
- <TR>
- <TH>picture</TH>
- </TR>
- <TR>
- <td>Image</td><td><%o.write(pict); %></td>
- <%o.flush();
- o.close();%>
- </TR>
- </TABLE>
- <BR>
- <%
- o.flush();
- o.close();
- %>
- <%
- }
- }
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- %>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement