Advertisement
Guest User

product.jsp

a guest
Jun 1st, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.58 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <%@ page import = "java.io.IOException"%>
  3. <%@ page import = "java.io.PrintWriter"%>
  4. <%@ page import = "java.util.ArrayList"%>
  5. <%@ page import = "java.util.Collection"%>
  6. <%@ page import = "java.util.Collections"%>
  7. <%@ page import = "javax.servlet.http.*"%>
  8.  
  9.  
  10. <%@ page import="java.io.*,java.util.*,java.sql.*"%>
  11. <%@ page import="javax.servlet.http.*,javax.servlet.*" %>
  12.  
  13. <html>
  14. <head>
  15. <style>
  16. @font-face { font-family: Moon Flower; src: url('Moon Flower.ttf'); }
  17. @font-face { font-family: Moon Flower; font-weight: bold; src: url('Moon Flower Bold.ttf');}
  18.  
  19. * {
  20. font-family: Verdana;
  21. font-size: 15px;
  22. }
  23.  
  24. div{ width: 50%; height: 100%; float: left;text-align: center; font-size: 33px;font-weight: bold;}
  25. #img1 {
  26. margin-right: auto;
  27. margin-left: auto;
  28. display: block;
  29. max-width: 100%;
  30. width: auto;
  31. height: auto;
  32. text-align: center;
  33.  
  34. }
  35. #link {
  36. font-family: Moon Flower;
  37. color: gray;
  38. text-decoration: none;
  39. font-size: 80px;
  40. }
  41. img {
  42. width: 200px;
  43. }
  44. .Main {
  45. width: 500px;
  46. display: block;
  47. margin: 0 auto;
  48. text-align: center;
  49. }
  50. #div1{
  51. width: 80%;
  52. text-align: right;
  53. font-size: 40px;
  54. font-weight: normal;
  55. }
  56. #div2{
  57. width: 20%;
  58. text-align: left;
  59. }
  60. ul{
  61. font-weight: normal;
  62. font-size: 30px;
  63.  
  64. }
  65. label{
  66. display: inline-block;
  67. float: left;
  68. clear: left;
  69. width: 150px;
  70. }
  71. input {
  72. font-family: Moon Flower;
  73. color: black;
  74. font-size: 19px;
  75. font-weight: bold;
  76. display: inline-block;
  77. float:left;
  78. }
  79. input.radiobutton {
  80. display:inline-block;
  81. float:left;
  82. margin-left:1cm;
  83. }
  84.  
  85.  
  86. </style>
  87. <br></br>
  88. <img id="img1" src="banner.jpg" >
  89. <br></br>
  90. <div><a href="RemoveView?pid=f1" , id="link">Home</a></div>
  91. <!--<div><a href="MainPage" onclick="myJSFunc()", id="link">Home</a></div>-->
  92. <div><a href="RemoveView?pid=f1", id="link">About Us</a></div>
  93. <br></br>
  94. </head>
  95. <%
  96. response.setContentType("text/html;charset=UTF-8");
  97. // Load the MYSQL JDBC driver.
  98. Class.forName("com.mysql.jdbc.Driver");
  99.  
  100. // Create a connection to the Database with a specific user and
  101. // password. Remember users have access to a specific tabel in the
  102. // database.
  103. // URL: jdbc:mysql://<host_name>/<database_name>
  104. // Connection con = DriverManager.getConnection( "jdbc:mysql://sylvester-mccoy-v3.ics.uci.edu:3306/inf124grp31",
  105. // "inf124grp31",
  106. // "bRU@Eph2");
  107. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/cs137", "danielhan", "12041992");
  108. // If the connection was successful, create a result set object
  109. Statement stmt = null;
  110. ResultSet rs = null;
  111. //SQL query command
  112. String SQL = "SELECT * FROM product";
  113. stmt = con.createStatement();
  114. rs = stmt.executeQuery(SQL);
  115. rs.next();
  116. %>
  117. <body>
  118. <table align="center">
  119. <tr>
  120. <td><img src=
  121.  
  122. <%
  123. out.print(rs.getString("mainphoto"));
  124. %>
  125.  
  126. " class="Main" alt=" <%
  127. out.print(rs.getString("P_Id"));
  128. %>"/></td>
  129.  
  130. <td width="300px"style="font-size:16px;"><b>
  131.  
  132. <%
  133. out.print(rs.getString("P_Id"));
  134. %>
  135.  
  136. </b><br>
  137.  
  138. <%
  139. out.print(rs.getString("description"));
  140. %>
  141.  
  142. </td>
  143. </tr>
  144.  
  145. </table>
  146.  
  147. <table align="center">
  148. <tr>
  149. <td><img src=
  150.  
  151. <%
  152. out.print(rs.getString("link1"));
  153. %>
  154.  
  155.  
  156. alt=" <%
  157. out.print(rs.getString("P_Id"));
  158. %>
  159. " /></td>
  160. <td><img src=
  161.  
  162. <%
  163. out.print(rs.getString("link2"));
  164. %>
  165.  
  166. alt=" <%
  167. out.print(rs.getString("P_Id"));
  168. %>" /></td>
  169. <td><img src=
  170.  
  171. <%
  172. out.print(rs.getString("link3"));
  173. %>
  174.  
  175. alt=" <%
  176. out.print(rs.getString("P_Id"));
  177. %>" /></td>
  178. </tr>
  179. </table>
  180.  
  181. <br></br>
  182. <div id="div2"><br></br></div>
  183. <div id="div2" style="font-size:20px;font-weight:bold;width:80%;">
  184. Description:
  185. <ul>
  186. <li>From
  187. <%
  188. out.print(rs.getString("origin"));
  189. %>
  190.  
  191. </li>
  192.  
  193. <li>Amount of
  194.  
  195. <%
  196. out.print(rs.getString("name"));
  197. %>
  198. per order:
  199.  
  200. <%
  201. out.print(rs.getString("amount"));
  202. %>
  203.  
  204. </li>
  205. <li>Product ID:
  206.  
  207. <%
  208. out.print(rs.getString("P_Id"));
  209. %>
  210. </li>
  211. </ul>
  212. </div>
  213.  
  214.  
  215. <br></br>
  216. <div id="div1">
  217. <b style="font-size:40px;"> Price: </b> $
  218. <%
  219. out.print(rs.getString("price"));
  220. %>
  221. </div>
  222.  
  223.  
  224. <br></br>
  225. <br></br>
  226. <br></br>
  227. <br></br>
  228. <br></br>
  229. <br></br>
  230. <br>
  231. <div style="width:100%;text-align:center" id="buttonWrapper">
  232. <form action=index.html>
  233. <!--<form action=ShoppingCart>-->
  234. <button style="text-align:center;width:150px" name=name value=
  235. <%out.print(rs.getString("P_Id"));%>
  236. >Add to Cart</button>
  237. </form>
  238. </div>
  239. <br></br><br></br>
  240. </body>
  241. <p>
  242. Access Count: <% out.print(getServletContext().getAttribute(
  243. rs.getString("P_Id")));
  244. %>
  245. </p>
  246. <% con.close();%>
  247. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement