Advertisement
Guest User

page4.jsp

a guest
Apr 22nd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.90 KB | None | 0 0
  1. <%--
  2. Document : page4
  3. Created on : Apr 22, 2017, 1:14:28 AM
  4. Author : Sam
  5. --%>
  6.  
  7. <%@page import="java.util.Arrays"%>
  8. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  13. <title>Summary - Professional Conference</title>
  14.  
  15. <%
  16. String[] seminar;
  17. String fName, lName, address, city, state, zip, pNumber, email, cName, cAddress, cCity, cState, cZip, cPNumber;
  18. int z = 0;
  19.  
  20. String javascript = "No";
  21. String php = "No";
  22. String mysql = "No";
  23. String apache = "No";
  24. String webservices = "No";
  25.  
  26. seminar = request.getParameterValues("seminar");
  27.  
  28. for(int i=0; i<seminar.length; i++) {
  29. if(seminar[i].equals("JavaScript")) {
  30. javascript = "Yes";
  31. }
  32. else if(seminar[i].equals("PHP")) {
  33. php = "Yes";
  34. }
  35. else if(seminar[i].equals("MySQL")) {
  36. mysql = "Yes";
  37. }
  38. else if(seminar[i].equals("Apache")) {
  39. apache = "Yes";
  40. }
  41. else if(seminar[i].equals("Web Services")) {
  42. webservices = "Yes";
  43. }
  44. }
  45.  
  46. //Store seminar check box into session
  47. if(javascript.equals("Yes"))
  48. session.setAttribute("javascript", "Yes");
  49. else
  50. session.setAttribute("javascript", "No");
  51.  
  52. if(php.equals("Yes"))
  53. session.setAttribute("php", "Yes");
  54. else
  55. session.setAttribute("php", "No");
  56.  
  57. if(mysql.equals("Yes"))
  58. session.setAttribute("mysql", "Yes");
  59. else
  60. session.setAttribute("mysql", "No");
  61.  
  62. if(apache.equals("Yes"))
  63. session.setAttribute("apache", "Yes");
  64. else
  65. session.setAttribute("apache", "No");
  66.  
  67. if(webservices.equals("Yes"))
  68. session.setAttribute("webservices", "Yes");
  69. else
  70. session.setAttribute("webservices", "No");
  71.  
  72. //Get parameter from session and assign variables to be displayed
  73. if(!(session.getAttribute("fName")).equals(""))
  74. fName = (String) session.getAttribute("fName");
  75. else {
  76. fName = "<font color='red'>**REQUIRED**</font>";
  77. z = 1;
  78. }
  79.  
  80. if(!(session.getAttribute("lName")).equals(""))
  81. lName = (String) session.getAttribute("lName");
  82. else {
  83. lName = "<font color='red'>**REQUIRED**</font>";
  84. z = 1;
  85. }
  86.  
  87. if(!(session.getAttribute("address")).equals(""))
  88. address = (String) session.getAttribute("address");
  89. else {
  90. address = "<font color='red'>**REQUIRED**</font>";
  91. z = 1;
  92. }
  93.  
  94. if(!(session.getAttribute("city")).equals(""))
  95. city = (String) session.getAttribute("city");
  96. else {
  97. city = "<font color='red'>**REQUIRED**</font>";
  98. z = 1;
  99. }
  100.  
  101. if(!(session.getAttribute("state")).equals(""))
  102. state = (String) session.getAttribute("state");
  103. else {
  104. state = "<font color='red'>**REQUIRED**</font>";
  105. z = 1;
  106. }
  107.  
  108. if(!(session.getAttribute("zip")).equals(""))
  109. zip = (String) session.getAttribute("zip");
  110. else {
  111. zip = "<font color='red'>**REQUIRED**</font>";
  112. z = 1;
  113. }
  114.  
  115. if(!(session.getAttribute("pNumber")).equals(""))
  116. pNumber = (String) session.getAttribute("pNumber");
  117. else {
  118. pNumber = "<font color='red'>**REQUIRED**</font>";
  119. z = 1;
  120. }
  121.  
  122. if(!(session.getAttribute("email")).equals(""))
  123. email = (String) session.getAttribute("email");
  124. else {
  125. email = "<font color='red'>**REQUIRED**</font>";
  126. z = 1;
  127. }
  128.  
  129. if(!(session.getAttribute("cName")).equals(""))
  130. cName = (String) session.getAttribute("cName");
  131. else {
  132. cName = "<font color='red'>**REQUIRED**</font>";
  133. z = 1;
  134. }
  135.  
  136. if(!(session.getAttribute("cAddress")).equals(""))
  137. cAddress = (String) session.getAttribute("cAddress");
  138. else {
  139. cAddress = "<font color='red'>**REQUIRED**</font>";
  140. z = 1;
  141. }
  142.  
  143. if(!(session.getAttribute("cCity")).equals(""))
  144. cCity = (String) session.getAttribute("cCity");
  145. else {
  146. cCity = "<font color='red'>**REQUIRED**</font>";
  147. z = 1;
  148. }
  149.  
  150. if(!(session.getAttribute("cState")).equals(""))
  151. cState = (String) session.getAttribute("cState");
  152. else {
  153. cState = "<font color='red'>**REQUIRED**</font>";
  154. z = 1;
  155. }
  156.  
  157. if(!(session.getAttribute("cZip")).equals(""))
  158. cZip = (String) session.getAttribute("cZip");
  159. else {
  160. cZip = "<font color='red'>**REQUIRED**</font>";
  161. z = 1;
  162. }
  163.  
  164. if(!(session.getAttribute("cPNumber")).equals(""))
  165. cPNumber = (String) session.getAttribute("cPNumber");
  166. else {
  167. cPNumber = "<font color='red'>**REQUIRED**</font>";
  168. z = 1;
  169. }
  170.  
  171. %>
  172.  
  173. </head>
  174. <body>
  175. <h1>Summary</h1>
  176.  
  177. <form name="form1" action="register.jsp" method="post">
  178.  
  179. You entered the following information.
  180. <br/>
  181. <br/>
  182. <table border="1">
  183. <tr>
  184. <td>
  185. <a href="page1.jsp"><h2>Personal Information</h2></a>
  186. First Name : <%= fName %>
  187. <br/>
  188. Last Name : <%= lName %>
  189. <br/>
  190. Address : <%= address %>
  191. <br/>
  192. City : <%= city %>
  193. <br/>
  194. State : <%= state %>
  195. <br/>
  196. Zip : <%= zip %>
  197. <br/>
  198. Phone : <%= pNumber %>
  199. <br/>
  200. E-mail : <%= email %>
  201. </td>
  202. <td>
  203. <a href="page2.jsp"><h2>Company Information</h2></a>
  204. First Name : <%= cName %>
  205. <br/>
  206. Address : <%= cAddress %>
  207. <br/>
  208. City : <%= cCity %>
  209. <br/>
  210. State : <%= cState %>
  211. <br/>
  212. Zip : <%= cZip %>
  213. <br/>
  214. Phone : <%= cPNumber %>
  215. <br/>
  216. <br/>
  217. <br/>
  218. </td>
  219. <td>
  220. <a href="page3.jsp"><h2>Seminars</h2></a>
  221. JavaScript seminar : <%= javascript %>
  222. <br/>
  223. PHP seminar : <%= php %>
  224. <br/>
  225. MySQL seminar : <%= mysql %>
  226. <br/>
  227. Apache seminar : <%= apache %>
  228. <br/>
  229. Web Services seminar : <%= webservices %>
  230. <br/>
  231. <br/>
  232. <br/>
  233. <br/>
  234.  
  235. </td>
  236. </tr>
  237. </table>
  238.  
  239. <br/>
  240.  
  241. <%
  242. if(z == 1)
  243. out.println("<font color='red'>You cannot register for the conference until you fill out all **REQUIRED** fields!</font>");
  244. else
  245. out.println("<input type='submit' value='Register'>");
  246. %>
  247.  
  248. <br/><br/>
  249. <form name="form2" action="page3.jsp" method="post">
  250. <input type="submit" value="Back">
  251. </form>
  252. <br/>
  253. <form name="form3" action="page5.jsp" method="post">
  254. <input type="submit" value="Start Over">
  255. </form>
  256. </body>
  257. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement