Advertisement
Guest User

Untitled

a guest
Mar 8th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.69 KB | None | 0 0
  1.  
  2. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  3. <%@ page import ="java.sql.*" %>
  4. <% Class.forName("com.mysql.jdbc.Driver"); %>
  5. <% String parametr1 = request.getParameter("parametr1");%>
  6. <!DOCTYPE html>
  7. <html>
  8. <style>
  9. #container
  10. {
  11. width: 1000px;
  12. margin-left:auto;
  13. margin-right:auto;
  14. }
  15. #logo
  16. {
  17. background-color: black;
  18. color: #ffffff;
  19. text-align: left;
  20. max-width: 11px;
  21. min-height: 50px;
  22. padding: 15px;
  23. }
  24. #logowanie
  25. {
  26. background-color: black;
  27. color: #ffffff;
  28.  
  29.  
  30. }
  31. #navigation
  32. {
  33. clear:both;
  34. background-color: aqua;
  35. color: #ffffff;
  36. float:left;
  37. width: 15%;
  38. min-height: 620px;
  39. padding: 20px;
  40. }
  41. #content
  42. {
  43. background-color: lightblue;
  44. color: #ffffff;
  45. width: 70%;
  46. padding: 40px;
  47. min-height: 580px;
  48. float:left;
  49.  
  50. }
  51. #reklama
  52. {
  53. background-color: black;
  54. color: #ffffff;
  55. width: 120px;
  56. min-height: 620px;
  57.  
  58. float:left;
  59.  
  60. }
  61. #stopka
  62. {
  63. background-color: blue;
  64. color: #ffffff;
  65. color: #ffffff;
  66. clear:both;
  67.  
  68. }
  69. ul.menu
  70. {
  71. padding: 0 20px;
  72. }
  73.  
  74. ul.menu a:link, ul.menu a:visited
  75. {
  76. width:166px;
  77. }
  78.  
  79. </style>
  80. <head>
  81.  
  82. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  83. <title>Sklep</title>
  84. </head>
  85. <body>
  86. <%!
  87. public class Actor{
  88. String URL = "jdbc:mysql://localhost:3306/mysql";
  89. String USERNAME = "root";
  90. String PASSWD = "";
  91. String mem="";
  92. Connection connection = null;
  93. PreparedStatement select= null;
  94. ResultSet resultSet = null;
  95. int a = 0;
  96. public void setmem(String rec){
  97. mem=rec;
  98. }
  99. public Actor(String rec){
  100. try{
  101. mem=rec;
  102. connection = DriverManager.getConnection(URL, USERNAME,PASSWD );
  103. select = connection.prepareStatement("SELECT * FROM products WHERE id="+mem );
  104. }
  105. catch (SQLException e){
  106. e.printStackTrace();
  107. }
  108. }
  109. public int check(){
  110. try{
  111. resultSet = select.executeQuery();
  112.  
  113. }
  114. catch (SQLException e){
  115. e.printStackTrace();
  116. }
  117. return a;
  118. }
  119. public ResultSet getActors(){
  120.  
  121. try{
  122. resultSet = select.executeQuery();
  123.  
  124. } catch (SQLException e){
  125. e.printStackTrace();
  126. }
  127. return resultSet;
  128. }
  129.  
  130. }
  131. %>
  132. <%
  133.  
  134. Actor actor = new Actor(parametr1);
  135. ResultSet actors = actor.getActors();
  136.  
  137. %>
  138. <form method="post" action="login.jsp">
  139. <div id="container"
  140. <div id="logo">
  141.  
  142. <h1 align="center">Sklep internetowy</h1>
  143.  
  144.  
  145. </div>
  146. <br>
  147. <div id="logwanie">
  148. <%
  149. if ((session.getAttribute("userid") == null) || (session.getAttribute("userid") == "")) {
  150. %>
  151. You are not logged in (Please Login)
  152.  
  153.  
  154. <% out.println("<table border=\"1\" width=\"100%\" cellpadding=\"3\"><thead><tr><tbody><td>User Name: <input type=\"text\" name=\"uname\" value=\"\" /> Password: <input type=\"password\" name=\"pass\" value=\"\" /><input type=\"submit\" value=\"Login\" /><input type=\"reset\" value=\"Reset\" /></td></tr><tr><td colspan=\"2\">Yet Not Registered!! <a href=\"reg.jsp\">Register Here</a></td></tr></tbody></table></div>");} else {
  155. %>
  156. <div id="welcome">
  157. Welcome <%=session.getAttribute("userid")%>
  158. <a href="shoppingcard.jsp">Shopping Card</a>
  159. <a href='logout.jsp' align="left">Log out</a>
  160.  
  161. </div>
  162. <%
  163. }
  164. %>
  165. <div id="navigation"><table border ="1">
  166.  
  167.  
  168. </table>
  169.  
  170. <ul>
  171. <li><a href="#" onclick="javascript:rozwin('menu123')">Procesory</a>
  172. <ul id="menu123" class="menu" style="display:none;">
  173. <li><a href="http://localhost:8080/WebApplication3/index.jsp?parametr1=INTEL" onclick="javascript:rozwin('menu1234')">INTEL</a>
  174.  
  175. <li><a href="http://localhost:8080/WebApplication3/index.jsp?parametr1=AMD" onclick="javascript:rozwin('menu12345')">AMD</a>
  176.  
  177. </ul>
  178. </li>
  179. <li><a href="#" onclick="javascript:rozwin('menu2')">Dyski</a>
  180. <ul id="menu2" class="menu" style="display:none;">
  181.  
  182. <li><a href="http://localhost:8080/WebApplication3/index.jsp?parametr1=SSD" onclick="javascript:rozwin('menu1234')">SSD</a>
  183.  
  184. <li><a href="http://localhost:8080/WebApplication3/index.jsp?parametr1=HDD" onclick="javascript:rozwin('menu1234')">HDD</a>
  185. </ul></li>
  186. <li><a href="#" onclick="javascript:rozwin('menu3')">GPU</a>
  187. <ul id="menu3" class="menu" style="display:none;">
  188. <li><a href="http://localhost:8080/WebApplication3/index.jsp?parametr1=GFORCE" onclick="javascript:rozwin('menu1234')">GFORCE</a>
  189. <li><a href="http://localhost:8080/WebApplication3/index.jsp?parametr1=RADEON" onclick="javascript:rozwin('menu1234')">RADEON</a>
  190.  
  191. </ul></li>
  192. </ul>
  193.  
  194. </div>
  195.  
  196.  
  197. <div id="content">
  198. <h1>zawartosc</h1>
  199. <% while (actors.next()) {%>
  200.  
  201. <img src="photo/<%= actors.getString("name")
  202. %>.jpg" width="500" height="500" border="0" align="left"/>
  203. <br><br><br><br>
  204. Nazwa produktu:
  205. <%= actors.getString("name")
  206. %>
  207. <br>
  208. Cena:
  209. <%= actors.getString("price")
  210. %>
  211. zl<br>
  212. Ilosc dostepnych sztuk:
  213. <%= actors.getString("quantity")
  214. %>
  215. <br>
  216. Opis:
  217. <%= actors.getString("description")
  218. %>
  219. <br>
  220. <% } %>
  221. </div>
  222. <div id="reklama">
  223.  
  224. <h1>reklama</h1>
  225. </div>
  226. <div id="stopka">
  227. <h1>stopka</h1>
  228. </div>
  229.  
  230. </div>
  231. </form>
  232. </body>
  233. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement