Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Advance Java course work under NCC Education June 2011

253 views

Published on

Advance Java course work under NCC Education June 2011. This assignment related with a JSP web application.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Advance Java course work under NCC Education June 2011

  1. 1. Statement and Confirmation of Own Work Programme/Qualification name: Each NCC Education assessed assignment submitted by you must have this statement attached to the assignment as the cover page or it will not be accepted for marking. Please ensure that this statement is either firmly attached to the cover of the assignment or electronically inserted into the front of the assignment. Student declaration I have read and understood NCC Education’s Policy on Academic Dishonesty and Plagiarism. I can confirm the following details: Student ID/Registration number: 00120142 Name: Md. Mahbub Alam Centre Name: Daffodil Institute of IT Module Name: Internet System Administration Module Leader: Mr. Shamsuddin Ahmmad Number of words: I confirm that this is my own work and that I have not plagiarized any part of it. I have also noted the assessment criteria and pass mark for assignments. Due Date: Student Signature: Submitted Date:
  2. 2. Acknowledgment: I am Md. Mahbub Alam is grateful to Daffodil Institute of IT (DIIT) for giving the chance to doing the assignment in the field of Advance Java and it’s such a pleasure to me. I am also grateful & like to express thanks to Mr. Shamsuddin Ahammad Lecturer of Advance Java of DIIT. His continues support, concentration & encouragement help me to complete this assignment. Huge unknown things are now know to me by doing this assignment. In class room we collect theoretical knowledge about Advance Java but practically I gather knowledge by doing this assignment. It was a glorious memory by doing this assignment in my Life. Advanced Java June 2011 Final @NCC Education 2011
  3. 3. Task 1: Problem Statement:  Design the database required to drive the outline specification.  Set up the structure of this database using a DBMS.  Design suitable test data and use it to populate the database that you have just set up.  Design and set up a separate simple database to record members’ feedback comments. Introduction: In this task I have to create an Entity relationship diagram and data dictionary of the system. I have to describe about aim and objectives of the System. Entity Relationship Diagram (ERD): Advanced Java June 2011 Final @NCC Education 2011
  4. 4. Normalized Entity Tables: Table Name: Bicycle Detail Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Bicycle Detail ID INTEGER 5 Not null Yes No - - - Make DATE TIME Not null No No - - - Model VARCHAR 15 Null No No - - - Type VARCHAR 15 Null No No - - - Frame Size INTEGER 2 Not null No No - - - Wheel Size INTEGER 2 Not null No No - - - Colour VARCHAR 10 Null No No - - - Number Of Gears INTEGER 1 Not Null No No - - - Basic Price INTEGER 4 Not Null No No - - - Retailer ID INTEGER 5 Not Null No Yes Retailer CASCADE CASCADE Table Name: Retailer Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Retailer ID INTEGER 5 Not null Yes No - - - Name Of Retailer VARCHAR 20 Not null No No - - - Postal Address VARCHAR 50 Not null No No - - - Email Address VARCHAR 20 Not null No No - - - Phone Number INTEGER 14 Not null No No - - - Advanced Java June 2011 Final @NCC Education 2011
  5. 5. Table Name: Bicycle Option Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Bicycle Option ID INTEGER 5 Not null Yes No - - - Retailer ID INTEGER 5 Not null No Yes Retailer CASCADE CASCADE Name Of Option VARCHAR 30 Not null No No - - - Description of Option VARCHAR 100 Not null No No - - - Price Of Option INTEGER 4 Not null No No - - - Table Name: Member Information Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Member User Name VARCHAR 10 Not null Yes No - - - Password VARCHAR 20 Not null No No - - - Member Name VARCHAR 20 Not null No No - - - Email Address VARCHAR 20 Not null No No - - - Table Name: Comment Table Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Member User Name VARCHAR 20 Not null yes No Member Information CASCADE CASCADE Interests VARCHAR 20 Not null No No - - - Comments VARCHAR 45 Not null No No - - - Advanced Java June 2011 Final @NCC Education 2011
  6. 6. Create database using a DBMS: Figure: MySql Query Browser Opening. Figure: Create New Schema or Database on Bicycle name. Advanced Java June 2011 Final @NCC Education 2011
  7. 7. Figure: Create Bicycle_Detail Table. Figure: Create Retailer table. Advanced Java June 2011 Final @NCC Education 2011
  8. 8. Figure: Create relation between Retailer table & Bicycle Detail Table. Figure: Create Bicycle Option Table. Advanced Java June 2011 Final @NCC Education 2011
  9. 9. Figure: Create relation between Retailer table & Bicycle Option Table. Figure: Member Information Table creation on the database. Advanced Java June 2011 Final @NCC Education 2011
  10. 10. Figure: Time of input data in the Retailer table. Figure: Retailer table with number of data. Advanced Java June 2011 Final @NCC Education 2011
  11. 11. Figure: Bicycle Option table with number of data insertion. Figure: Bicycle Detail table with number of data insertion. Advanced Java June 2011 Final @NCC Education 2011
  12. 12. Figure: Member Information table with number of data insertion. Summary: In the above, I complete task 1 by flowing the scenario of task 1. I describe here about Bicycle club new system. I draw an ERD diagram on this task. Describe about Above. Advanced Java June 2011 Final @NCC Education 2011
  13. 13. Task 2 Introduction: on this task I have to design Java server pages. User Interface: Figure: Log on User interface Advanced Java June 2011 Final @NCC Education 2011
  14. 14. Figure: Search page Advanced Java June 2011 Final @NCC Education 2011
  15. 15. Figure: Print option page with query table of content Advanced Java June 2011 Final @NCC Education 2011
  16. 16. Figure: Member Feed Back or Member survey page Advanced Java June 2011 Final @NCC Education 2011
  17. 17. Figure: Maintenance interface as retailer form Advanced Java June 2011 Final @NCC Education 2011
  18. 18. Flow Chart: Figure: Flow Chart of Search Page Summary: in the above I design the java server pages to meet the requirement of the system. Advanced Java June 2011 Final @NCC Education 2011 START Model, Type, Color, gear, frameSize, wheelsize, price if(! model.equals(sear chResult.get(i).get Model()))search form. success.jsperror.jsp STOP
  19. 19. Task 3 Introduction: In this task I have to write the code of Java server pages, CSS and MyEntityManager. Coding are under the below: CSS: body { color:#000000; background-color:#B3B3B3; margin:0;} #container { margin-left:auto; margin-right:auto; text-align:center; } a img { border:none;} #header{background-color:#C4D71C; font-size:70px; font-style:oblique; color: darkgreen; font-weight: bolder; font-family:Geneva;} #fotter{text-align: center; background-image:url(../image/footer.png); background-position:center; background-repeat:no-repeat; text-align:center; font-weight: bolder; font-size:16px; color:darkgreen;} #l{text-align:left;} #c{text-align:center;} #r{text-align:right;} #vl{vertical-align:middle;} a:link,a:visited { display:block; font-weight:bold; color:#FFFFFF; background-color:#98bf21; width:150px; text-align:center; padding:4px; text-decoration:none;} a:hover,a:active{ background-color:#7A991A;} #pageLink{ vertical-align:top; text-align:center;} MyEntityManager: package bicycle.beans; import java.util.logging.Level; import java.util.logging.Logger; import javax.naming.Context; import javax.naming.InitialContext; import javax.persistence.EntityManager; import javax.transaction.UserTransaction; public class MyEntityManager { Context ctx; UserTransaction utx; EntityManager em; Advanced Java June 2011 Final @NCC Education 2011
  20. 20. public MyEntityManager() { try { ctx = new InitialContext(); utx = (UserTransaction) ctx.lookup("java:comp/env/UserTransaction"); utx.begin(); em = (EntityManager) ctx.lookup("java:comp/env/persistence/LogicalName"); utx.commit(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", e); throw new RuntimeException(e); } } public boolean persist(Object object) { try { utx.begin(); em.persist(object); utx.commit(); return true; } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", e); } return false; } public boolean update(Object object) { try { utx.begin(); em.persist(object); utx.commit(); return true; } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", e); } return false; } public boolean delete(Object object) { boolean isDeleted = false; em.getTransaction().begin(); try { em.remove(object); em.getTransaction().commit(); isDeleted = true; } catch (Exception e) { em.getTransaction().rollback(); } Advanced Java June 2011 Final @NCC Education 2011
  21. 21. return isDeleted; } public Login login(String username,String password) { Login login = em.find(Login.class, username); if (login != null) { if (login.getPassword().equals(password)) { return login; } } return null; } public EntityManager getEntityManager() { return em; } } Index.JSP <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="3" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr> <td width="200"><img name="Cycle" src="image/cycle1.jpg" width="190" height="250" alt=""></td> <td> <form id="form" name="form" method="post" action="loginprocess.jsp"> <fieldset id="form"><legend><b>Login Here</b></legend><div id="c"> <table width="100%"> <tr> Advanced Java June 2011 Final @NCC Education 2011
  22. 22. <td id="l"><label>User Name</label></td> <td id="c">:</td> <td id="r"><input name="username" type="text" size="45"></td></tr> <tr> <td id="l"><label>Password</label></td> <td id="c">:</td> <td id="r"><input name="password" type="password" size="45"></td> </tr> <tr><td colspan="3"><br><div id="c"> <input type="image" src="image/submit.gif" value="submit"></div></td></tr> </table></div></fieldset></form> <div>Welcome to Bicycle club. We are providing valuable information about bicycle and its equipments. You can know detail from this web site about a bicycle. It’s a fully dynamic web site. It’s user friendly check out now.</div><br> <td width="200"><img name="Cycle" src="image/bicycle2.jpg" width="190" height="250" alt=""></td> <tr id="vl"> <td height="80" colspan="3" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> List_comment.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); Advanced Java June 2011 Final @NCC Education 2011
  23. 23. } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750" valign="top"><div id="r">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;<a href="logoutProcess.jsp">logout</a></div><div> <div style="color:#090; font-weight:bold;font- size:16px;"><u>Bicycle Detail Information</u></div><hr> <table border="1" cellspacing="1" cellpadding="1" width="747"> <tr> <% MyEntityManager myEntityManager = new MyEntityManager(); Vector<BicycleDetail> searchResult = (Vector<BicycleDetail>) myEntityManager.getEntityManager().createNamedQuery("BicycleDetail.findAll" ).getResultList(); for (int i = 0; i < searchResult.size(); i+ +) { %> <td width="20"> <%= searchResult.get(i).getBicycleDetailID()%></td> <td width="100"> <%= searchResult.get(i).getMake()%></td> Advanced Java June 2011 Final @NCC Education 2011
  24. 24. <td width="100"> <%= searchResult.get(i).getType()%></td> <td width="70"> <%= searchResult.get(i).getColour()%></td> <td width="20"> <%= searchResult.get(i).getFrameSize()%></td> <td> <%= searchResult.get(i).getNumberOfGears() %></td> <td> <%= searchResult.get(i).getWheelSize() %></td> <td> <%= searchResult.get(i).getBasicPrice() %></td> <td width="150"><a href="admin_bicycleDetail_Edit.jsp?bicyclemodel=<%= searchResult.get(i).getBicycleDetailID()%>">Edit</a></td> <td width="150"><a href="admin_bicycleDetail_Delete.jsp?bicyclemodel=<%= searchResult.get(i).getBicycleDetailID()%>" onclick="deleteBicycleDetailProccess.jsp" >Delete</a></td> </tr> <% } %> </table> </div> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> editOptionProccess.JSP <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); BicycleDetail bicycleDetail = (BicycleDetail)session.getAttribute("bicycle"); Advanced Java June 2011 Final @NCC Education 2011
  25. 25. bicycleDetail.setMake(request.getParameter("make")); bicycleDetail.setModel(request.getParameter("model")); bicycleDetail.setType(request.getParameter("type")); bicycleDetail.setFrameSize(Integer.parseInt(request.getParameter("frameSize "))); bicycleDetail.setWheelSize(Integer.parseInt(request.getParameter("wheelSize "))); bicycleDetail.setColour(request.getParameter("colour")); bicycleDetail.setNumberOfGears(Integer.parseInt(request.getParameter("gears "))); bicycleDetail.setBasicPrice(Integer.parseInt(request.getParameter("price")) ); if (myEntityManager.update(bicycleDetail)) { response.sendRedirect("successPage.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> editRetailerProcess.jsp <%@page import="bicycle.beans.Retailer"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); Retailer retailer = (Retailer)session.getAttribute("bicycle"); retailer.setRetailerID(Integer.parseInt(request.getParameter("Retailer_ID") )); Advanced Java June 2011 Final @NCC Education 2011
  26. 26. retailer.setNameOfRetailer(request.getParameter("Retailer_Name")); retailer.setPostalAddress(request.getParameter("Address")); retailer.setEmailAddress(request.getParameter("Email")); retailer.setPhoneNumber(Integer.parseInt(request.getParameter("Phone"))); if (myEntityManager.update(retailer)) { response.sendRedirect("successPage.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> error.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr><td height="600" width="750"><div style="color:#F00; font- size:18px;"> An Error has been occur during your work process...!!!</div></td></tr> <tr id="l"> Advanced Java June 2011 Final @NCC Education 2011
  27. 27. <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011 </td> </tr> </table> </body> </html> list_bicycleDetail.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> Advanced Java June 2011 Final @NCC Education 2011
  28. 28. List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750" valign="top"><div id="r">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;<a href="logoutProcess.jsp">logout</a></div><div> <div style="color:#090; font-weight:bold;font- size:16px;"><u>Bicycle Detail Information</u></div><hr> <table border="1" cellspacing="1" cellpadding="1" width="747"> <tr> <% MyEntityManager myEntityManager = new MyEntityManager(); Vector<BicycleDetail> searchResult = (Vector<BicycleDetail>) myEntityManager.getEntityManager().createNamedQuery("BicycleDetail.findAll" ).getResultList(); for (int i = 0; i < searchResult.size(); i+ +) { %> <td width="20"> <%= searchResult.get(i).getBicycleDetailID()%></td> <td width="100"> <%= searchResult.get(i).getMake()%></td> <td width="100"> <%= searchResult.get(i).getType()%></td> <td width="70"> <%= searchResult.get(i).getColour()%></td> <td width="20"> <%= searchResult.get(i).getFrameSize()%></td> <td> <%= searchResult.get(i).getNumberOfGears() %></td> <td> <%= searchResult.get(i).getWheelSize() %></td> <td> <%= searchResult.get(i).getBasicPrice() %></td> <td width="150"><a href="admin_bicycleDetail_Edit.jsp?bicyclemodel=<%= searchResult.get(i).getBicycleDetailID()%>">Edit</a></td> <td width="150"><a href="success.jsp? bicyclemodel=<%= searchResult.get(i).getBicycleDetailID()%>" onclick="deleteBicycleDetailProccess.jsp" >Delete</a></td> </tr> <% } %> Advanced Java June 2011 Final @NCC Education 2011
  29. 29. </table> </div> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> list_bicycleoption.jsp <%@page import="bicycle.beans.Retailer" %> <%@page import="bicycle.beans.BicycleOption"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> Advanced Java June 2011 Final @NCC Education 2011
  30. 30. <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750" valign="top"><div id="r">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;<a href="logoutProcess.jsp">logout</a></div><div> <div style="color:#090; font-weight:bold;font- size:16px;"><u>Bicycle Detail Information</u></div><hr> <table border="1" cellspacing="1" cellpadding="1" width="747"> <tr> <% MyEntityManager myEntityManager = new MyEntityManager(); Vector<BicycleOption> searchResult = (Vector<BicycleOption>) myEntityManager.getEntityManager().createNamedQuery("BicycleOption.findAll" ).getResultList(); for (int i = 0; i < searchResult.size(); i+ +) { %> <td> <%= searchResult.get(i).getBicycleOptionID()%></td> <td> <%= searchResult.get(i).getRetailer().getRetailerID()%></td> <td> <%= searchResult.get(i).get%></td> <td> <%= searchResult.get(i).getColour()%></td> <td> <%= searchResult.get(i).getFrameSize() %></td> <td> <%= searchResult.get(i).getNumberOfGears() %></td> <td> <%= searchResult.get(i).getWheelSize() %></td> <td> <%= searchResult.get(i).getBasicPrice() %></td> <td width="150"><a href="admin_bicycleDetail_Edit.jsp?retailerID=<%= searchResult.get(i).getBicycleDetailID()%>">Edit</a></td> <td width="150"><a href="admin_bicycleDetail_Delete.jsp?bicyclemodel=<%= searchResult.get(i).getBicycleDetailID()%>" onclick="deleteBicycleDetailProccess.jsp" >Delete</a></td> </tr> Advanced Java June 2011 Final @NCC Education 2011
  31. 31. <% } %> </table> </div> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> list_memberinfo.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> Advanced Java June 2011 Final @NCC Education 2011
  32. 32. <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750" valign="top"><div id="r">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;<a href="logoutProcess.jsp">logout</a></div><div> <div style="color:#090; font-weight:bold;font- size:16px;"><u>Bicycle Detail Information</u></div><hr> <table border="1" cellspacing="1" cellpadding="1" width="747"> <tr> <% MyEntityManager myEntityManager = new MyEntityManager(); Vector<BicycleDetail> searchResult = (Vector<BicycleDetail>) myEntityManager.getEntityManager().createNamedQuery("BicycleDetail.findAll" ).getResultList(); for (int i = 0; i < searchResult.size(); i+ +) { %> <td width="20"> <%= searchResult.get(i).getBicycleDetailID()%></td> <td width="100"> <%= searchResult.get(i).getMake()%></td> <td width="100"> <%= searchResult.get(i).getType()%></td> <td width="70"> <%= searchResult.get(i).getColour()%></td> <td width="20"> <%= searchResult.get(i).getFrameSize()%></td> <td> <%= searchResult.get(i).getNumberOfGears() %></td> <td> <%= searchResult.get(i).getWheelSize() %></td> <td> <%= searchResult.get(i).getBasicPrice() %></td> <td width="150"><a href="admin_bicycleDetail_Edit.jsp?bicyclemodel=<%= searchResult.get(i).getBicycleDetailID()%>">Edit</a></td> <td width="150"><a href="admin_bicycleDetail_Delete.jsp?bicyclemodel=<%= Advanced Java June 2011 Final @NCC Education 2011
  33. 33. searchResult.get(i).getBicycleDetailID()%>" onclick="deleteBicycleDetailProccess.jsp" >Delete</a></td> </tr> <% } %> </table> </div> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> list_retailer.jsp <%@page import="bicycle.beans.Retailer"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> Advanced Java June 2011 Final @NCC Education 2011
  34. 34. <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750" valign="top"><div id="r">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;<a href="logoutProcess.jsp">logout</a></div><div> <div style="color:#090; font-weight:bold;font- size:16px;"><u>Bicycle Detail Information</u></div><hr> <table border="1" cellspacing="1" cellpadding="1" width="747"> <tr> <% MyEntityManager myEntityManager = new MyEntityManager(); Vector<Retailer> searchResult = (Vector<Retailer>) myEntityManager.getEntityManager().createNamedQuery("Retailer.findAll").get ResultList(); for (int i = 0; i < searchResult.size(); i+ +) { %> <td> <%= searchResult.get(i).getRetailerID() %></td> <td> <%= searchResult.get(i).getNameOfRetailer()%></td> <td> <%= searchResult.get(i).getPostalAddress() %></td> <td> <%= searchResult.get(i).getEmailAddress() %></td> <td> <%= searchResult.get(i).getPhoneNumber() %></td> <td><a href="admin_retailer_Edit.jsp? retailerID=<%= searchResult.get(i).getRetailerID()%>">Edit</a></td> <td><a href="success.jsp?bicyclemodel=<%= searchResult.get(i).getRetailerID()%>" onclick="deleteRetailerProccess.jsp">Delete</a></td> </tr> <% } Advanced Java June 2011 Final @NCC Education 2011
  35. 35. %> </table> </div> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> searchproccess.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <script type="text/javascript"> function printpage() { window.print(); } </script> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login =(Login) session.getAttribute("login"); if(login==null) response.sendRedirect("index.jsp"); %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> <hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> Advanced Java June 2011 Final @NCC Education 2011
  36. 36. <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> <a href="list_bicycleDetail.jsp">Detail List</a> </td> <td width="750"><div id="l" style="vertical-align: top;">Profile Name: <%=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;<%=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div><br><br> <% MyEntityManager myEntityManager = new MyEntityManager(); Vector<BicycleDetail> searchResult = (Vector<BicycleDetail>)myEntityManager.getEntityManager().createNamedQuery( "BicycleDetail.findAll").getResultList(); String model = request.getParameter("model"); String type = request.getParameter("Select"); String colore =request.getParameter("colore"); for(int i=0;i<searchResult.size();i++) { if(!model.equals(searchResult.get(i).getModel())) { searchResult.remove(i); i--; } } for(int i=0;i<searchResult.size();i++) { if(!type.equals(searchResult.get(i).getType())) { searchResult.remove(i); i--; } } try { int frameSize =Integer.parseInt(request.getParameter("frameSize")); for(int i=0;i<searchResult.size();i++) { if(frameSize != searchResult.get(i).getFrameSize()) { Advanced Java June 2011 Final @NCC Education 2011
  37. 37. searchResult.remove(i); i--; } } } catch(NumberFormatException nfe) { } try { int wheelsize =Integer.parseInt(request.getParameter("wheelsize")); for(int i=0;i<searchResult.size();i++) { if(wheelsize != searchResult.get(i).getWheelSize()) { searchResult.remove(i); i--; } } } catch(NumberFormatException nfe) { } try { int price = Integer.parseInt(request.getParameter("price")); for(int i=0;i<searchResult.size();i++) { if(price != searchResult.get(i).getBasicPrice()) { searchResult.remove(i); i--; } } } catch(NumberFormatException nfe){} try{ int gear = Integer.parseInt(request.getParameter("gear")); for(int i=0;i<searchResult.size();i++) { if(gear != searchResult.get(i).getNumberOfGears()) { searchResult.remove(i); i--; } } } catch(NumberFormatException nfe){} Advanced Java June 2011 Final @NCC Education 2011
  38. 38. %> <div> <table border="1" cellspacing="1" cellpadding="1"> <% for(int i=0;i<searchResult.size();i++) { %> <tr> <td width="15"> <%= searchResult.get(i).getBicycleDetailID()%></td> <td width="100"> <%= searchResult.get(i).getMake() %></td> <td width="100"> <%= searchResult.get(i).getType() %></td> <td width="50"> <%= searchResult.get(i).getColour() %></td> <td width="50"> <%= searchResult.get(i).getFrameSize() %></td> <td width="50"> <%= searchResult.get(i).getNumberOfGears()%></td> <td width="50"> <%= searchResult.get(i).getWheelSize() %></td> <td width="50"> <%= searchResult.get(i).getBasicPrice() %></td> </tr> <% } %> </table><br><input type="image" src="image/print.PNG" onclick="printpage()"></div></td> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> SiteMap.jsp <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> Advanced Java June 2011 Final @NCC Education 2011
  39. 39. <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login =(Login) session.getAttribute("login"); if(login==null) response.sendRedirect("index.jsp"); %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <div style="vertical-align:middle; text-align:center"><img src="image/SiteMap.png" alt="Site Map" width="605" height="238" border="0" usemap="#Map"> </div> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> <map name="Map"> <area shape="rect" coords="244,9,382,74" href="index.jsp" target="_blank" alt="Index/ Home Page"> <area shape="rect" coords="6,168,142,233" href="search.jsp" target="_blank" alt="Search"> <area shape="rect" coords="206,169,431,232" href="member_servey.jsp" target="_blank" alt="Member Server"> Advanced Java June 2011 Final @NCC Education 2011
  40. 40. <area shape="rect" coords="463,169,600,232" href="SiteMap.jsp" target="_blank" alt="Site Map"> </map> </body> </html> search.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> Advanced Java June 2011 Final @NCC Education 2011
  41. 41. <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="searchprocess.jsp" method="post"><fieldset><legend><b>Search Here</b></legend><div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="18%" id="l"><label>Model</label></td> <td width="2%" id="c">:</td> <td width="29%" id="l"><input name="model" type="text"></td> <td colspan="3" id="l">&nbsp;</td> </tr> <tr> <td id="l">Type</td> <td id="c">:</td> <td id="l"><label> <select name="Select" size="1" id="Select"> <option>Five Star</option> <option>Renger</option> <option>Hero</option> <option>China</option> <option>Japan</option> </select> </label></td> <td width="19%" id="l">Colour</td> <td id="c" width="2%">:</td> <td width="30%" id="l"> <select name="colore" size="1" id="select"> <option>Black</option> <option>White</option> <option>Green</option> <option>Pink</option> <option>Blue</option> <option>Red</option> <option>Silver</option> </select></td> </tr> <tr> <td height="48" id="l">Frame Size </td> <td id="c">:</td> <td id="l"><input name="frameSize" type="text"></td> <td id="l">Number of Gear </td> <td id="c">:</td> <td id="l"><select name="gear" size="1" id="select2"> <option>03</option> <option>04</option> <option>05</option> <option>06</option></select></td></tr> <tr> Advanced Java June 2011 Final @NCC Education 2011
  42. 42. <td id="l">Wheel Size </td> <td id="c">:</td> <td id="l"><input name="wheelsize" type="text"></td> <td id="l">Price</td> <td id="c">:</td> <td id="l"><input name="price" type="text"></td> </tr> <tr> <td colspan="6" id="c"><INPUT type="submit" name="submit" value="submit"></td> </tr></table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> Memberservey.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> Advanced Java June 2011 Final @NCC Education 2011
  43. 43. <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="http://" method="post"><fieldset><legend><b>Search Here</b></legend><div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="17%" id="l"><label>Interest</label></td> <td width="2%" id="c">:</td> <td width="81%" id="l"><input name="interest" type="text" size="70"></td> </tr> <tr> <td id="l">Comment</td> <td id="c">:</td> <td id="l"><textarea name="wheelSizeTextarea" id="textarea" cols="50" rows="5"></textarea></td> </tr> <tr> <td colspan="4" id="c"><input type="Submit" name="Submit" value="Submit"></td></tr> </table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> Advanced Java June 2011 Final @NCC Education 2011
  44. 44. success.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login =(Login) session.getAttribute("login"); if(login==null) response.sendRedirect("index.jsp"); %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750" valign="top"><div id="r">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<input name="Logout" type="button" value="Logout" /></div><div> <div style="color:#090; font:sans-serif; font-size:16px;">Process Successfull</div> Advanced Java June 2011 Final @NCC Education 2011
  45. 45. </div> <tr id="l"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> logoutProccess.jsp <%@page import="javax.swing.JOptionPane"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> </head> <body> <% session.invalidate(); response.sendRedirect("index.jsp"); %> </body> </html> loginproccess.jsp <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); String username = request.getParameter("username"); Advanced Java June 2011 Final @NCC Education 2011
  46. 46. String password = request.getParameter("password"); Login login = myEntityManager.login(username, password); if(login!=null) { response.sendRedirect("search.jsp"); session.setAttribute("login",login); } else { response.sendRedirect("error.jsp"); } %> </body> </html> editBicycleDetailProccess.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); BicycleDetail bicycleDetail = (BicycleDetail)session.getAttribute("bicycle"); bicycleDetail.setMake(request.getParameter("make")); bicycleDetail.setModel(request.getParameter("model")); bicycleDetail.setType(request.getParameter("type")); bicycleDetail.setFrameSize(Integer.parseInt(request.getParameter("frameSize "))); bicycleDetail.setWheelSize(Integer.parseInt(request.getParameter("wheelSize "))); bicycleDetail.setColour(request.getParameter("colour")); Advanced Java June 2011 Final @NCC Education 2011
  47. 47. bicycleDetail.setNumberOfGears(Integer.parseInt(request.getParameter("gears "))); bicycleDetail.setBasicPrice(Integer.parseInt(request.getParameter("price")) ); if (myEntityManager.update(bicycleDetail)) { response.sendRedirect("successPage.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> Advanced Java June 2011 Final @NCC Education 2011
  48. 48. deleteRetailerProccess.jsp <%@page import="bicycle.beans.Retailer"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); Retailer retailer = (Retailer)session.getAttribute("bicycle"); if (myEntityManager.delete(retailer)) { response.sendRedirect("success.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> deleteOptionProccess.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); BicycleDetail bicycleDetail = (BicycleDetail)session.getAttribute("bicycle"); Advanced Java June 2011 Final @NCC Education 2011
  49. 49. if (myEntityManager.delete(bicycleDetail)) { response.sendRedirect("success.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> admin_comment.jsp <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> Advanced Java June 2011 Final @NCC Education 2011
  50. 50. <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="http://" method="post"><fieldset> <legend><b> Comments Form</b></legend> <div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="23%" id="l"><label>User Name</label></td> <td width="2%" id="c">:</td> <td width="75%" id="l"><input name="Retailer _Id" type="text" size="40"></td> </tr> <tr> <td id="l">Interest</td> <td id="c">:</td> <td id="l"><input type="textfield" name="Retailer_Name" size="40"></td> </tr> <tr> <td id="l">Comments</td> <td id="l">:</td> <td id="l"><textarea name="textarea" id="textarea" cols="38" rows="5"></textarea></td> </tr> <tr> <td colspan="4" id="c"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> admin_bicycleOptionedit.jsp <%@page import="bicycle.beans.BicycleOption"%> <%@page import="bicycle.beans.Retailer" %> Advanced Java June 2011 Final @NCC Education 2011
  51. 51. <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } MyEntityManager myEntityManager = new MyEntityManager(); BicycleOption bicycleOption = myEntityManager.getEntityManager().find(BicycleOption.class,Integer.parseIn t(request.getParameter("bicyclemodel"))); session.setAttribute("bicycle",bicycleOption); %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> Advanced Java June 2011 Final @NCC Education 2011
  52. 52. </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="editOptionProccess.jsp" method="post"><fieldset> <legend><b>Bicycle Option Form</b></legend> <div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="23%" id="l"><label>Bicycle Option ID</label></td> <td width="2%" id="c">:</td> <td width="75%" id="l"><input name="bicycleOptionID" type="text" size="40" value="< %=bicycleOption.getBicycleOptionID()%>"></td> </tr> <tr> <td id="l">Retailer ID</td> <td id="c">:</td> <td id="l"><input type="textfield" name="RetailerId" size="40" value="< %=bicycleOption.getRetailer().getRetailerID()%>"></td> </tr> <tr> <td id="l">Name</td> <td id="l">:</td> <td id="l"><input type="text" name="name" size="40" value="<%=bicycleOption.getNameOfOption() %>"></td></tr> <tr> <td id="l">Description</td> <td id="l">:</td> <td id="l"><textarea name="Description" cols="38" rows="5" ></textarea></td> </tr> <tr> <td id="l">Price</td> <td id="l">:</td> <td id="l"><input type="text" name="price" size="40"></td></tr> <tr> <td colspan="4" id="c"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> Advanced Java June 2011 Final @NCC Education 2011
  53. 53. admin_bicycleOption.jsp <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="addProccessBicycleOption.jsp" method="post"><fieldset> Advanced Java June 2011 Final @NCC Education 2011
  54. 54. <legend><b>Bicycle Option Form</b></legend> <div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="23%" id="l"><label>Bicycle Option ID</label></td> <td width="2%" id="c">:</td> <td width="75%" id="l"><input name="bicycleOptionID" type="text" size="40"></td> </tr> <tr> <td id="l">Retailer ID</td> <td id="c">:</td> <td id="l"><input type="textfield" name="RetailerId" size="40"></td> </tr> <tr> <td id="l">Name</td> <td id="l">:</td> <td id="l"><input type="text" name="name" size="40"></td></tr> <tr> <td id="l">Description</td> <td id="l">:</td> <td id="l"><textarea name="Description" id="textarea" cols="38" rows="5"></textarea></td> </tr> <tr> <td id="l">Price</td> <td id="l">:</td> <td id="l"><input type="text" name="price" size="40"></td></tr> <tr> <td colspan="4" id="c"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> admin_bicycleOption_Edit.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.Retailer" %> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> Advanced Java June 2011 Final @NCC Education 2011
  55. 55. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } MyEntityManager myEntityManager = new MyEntityManager(); BicycleDetail bicycleDetail = myEntityManager.getEntityManager().find(BicycleDetail.class,Integer.parseIn t(request.getParameter("retailerID"))); session.setAttribute("bicycle",bicycleDetail); %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< Advanced Java June 2011 Final @NCC Education 2011
  56. 56. %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="editBicycleDetailProccess.jsp" method="post"><fieldset> <legend><b>Bicycle Detail Form</b></legend><div id="c"> <table width="100%" cellspacing="10"> <tr> <td id="l">Make</td> <td id="c">:</td> <td id="l"><input type="textfield" name="Make" size="40" value="<%=bicycleDetail.getMake()%>"></td> </tr> <tr> <td id="l">Model</td> <td id="l">:</td> <td id="l"><input type="text" name="Model" size="40" value="<%=bicycleDetail.getModel()%>"></td></tr> <tr> <td id="l">Type</td> <td id="l">:</td> <td id="l"><input type="text" name="Type" size="40" value="<%=bicycleDetail.getType()%>"></td> </tr> <tr> <td id="l">Frame</td> <td id="l">:</td> <td id="l"><input type="text" name="frame" size="40" value="<%=bicycleDetail.getFrameSize()%>"></td></tr> <tr> <td id="l">Wheel Size</td> <td id="l">:</td> <td id="l"><input type="text" name="wheelsize" size="40" value="<%=bicycleDetail.getWheelSize() %>"></td></tr> <tr> <td id="l">Color</td> <td id="l">:</td> <td id="l"><input type="text" name="Colore" size="40" value="<%=bicycleDetail.getColour()%>"></td></tr> <tr> <td id="l">Gear</td> <td id="l">:</td> <td id="l"><input type="text" name="Gear" size="40" value="<%=bicycleDetail.getNumberOfGears() %>"></td></tr><tr> <td id="l">Price</td> <td id="l">:</td> <td id="l"><input type="text" name="Price" size="40" value="<%=bicycleDetail.getBasicPrice() %>"></td></tr> <tr> <td colspan="4" id="c"><input type="submit" name="Update" value="Update"></td> </tr> </table> </div></fieldset></form> Advanced Java June 2011 Final @NCC Education 2011
  57. 57. <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> admin_memberInfo.jsp <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if(!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> Advanced Java June 2011 Final @NCC Education 2011
  58. 58. <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="http://" method="post"><fieldset> <legend><b>Member Information</b></legend> <div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="23%" id="l"><label>User Name</label></td> <td width="2%" id="c">:</td> <td width="75%" id="l"><input name="username" type="text" size="40"></td> </tr> <tr> <td id="l">Password</td> <td id="c">:</td> <td id="l"><input name="textfield2" type="password" id="textfield" size="40"></td> </tr> <tr> <td id="l">Member Name</td> <td id="l">:</td> <td id="l"><input type="text" name="memberName" size="40"></td></tr> <tr> <td id="l">E-Mail</td> <td id="l">:</td> <td id="l"><input type="text" name="email" size="40"></td></tr> <tr> <td colspan="4" id="c"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> DeleteBicycleDetailProccess.jsp <%@page import="bicycle.beans.BicycleDetail"%> Advanced Java June 2011 Final @NCC Education 2011
  59. 59. <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); BicycleDetail bicycleDetail = (BicycleDetail)session.getAttribute("bicycle"); if (myEntityManager.delete(bicycleDetail)) { response.sendRedirect("success.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> addBicycleDetailProccess.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle- Add Process</title> </head> <body> <% MyEntityManager myEntityManager = new MyEntityManager(); BicycleDetail bicycleDetail = new BicycleDetail(); bicycleDetail.setBicycleDetailID(Integer.parseInt(request.getParameter("Bic ycleDetail_Id"))); bicycleDetail.setMake(request.getParameter("Make")); bicycleDetail.setModel(request.getParameter("Model")); Advanced Java June 2011 Final @NCC Education 2011
  60. 60. bicycleDetail.setType(request.getParameter("Type")); bicycleDetail.setFrameSize(Integer.parseInt(request.getParameter("selectFra me"))); bicycleDetail.setWheelSize(Integer.parseInt(request.getParameter("selectWhe el"))); bicycleDetail.setColour(request.getParameter("Colore")); bicycleDetail.setNumberOfGears(Integer.parseInt(request.getParameter("Gear" ))); bicycleDetail.setBasicPrice(Integer.parseInt(request.getParameter("Price")) ); if(myEntityManager.persist(bicycleDetail)) { response.sendRedirect("success.jsp"); } else { response.sendRedirect("error.jsp"); } %> </body> </html> Admin_retailer_Edit.jsp <%@page import="bicycle.beans.Retailer" %> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); } if (!login.getLevel().equals("admin")) { response.sendRedirect("search.jsp"); } MyEntityManager myEntityManager = new MyEntityManager(); Advanced Java June 2011 Final @NCC Education 2011
  61. 61. Retailer retailer = myEntityManager.getEntityManager().find(Retailer.class,Integer.parseInt(req uest.getParameter("retailerID"))); session.setAttribute("bicycle",retailer); %> <table border="0" cellpadding="5" cellspacing="5" width="900" bgcolor="#FFFFFF" id="container"> <tr> <td height="150" colspan="2" align="center" id="header">Welcome to Bicycle Club</td> </tr> <tr></tr> <td width="150" bgcolor="#C4D71C" id="pageLink">Page Links<hr> <a href="search.jsp">Search</a> <a href="member_servey.jsp">Member Servey</a> <a href="SiteMap.jsp">Site Map</a> Admin<hr> <a href="admin_retailer.jsp">Retailer Form</a> <a href="admin_bicycleDetail.jsp">Bicycle Detail</a> <a href="admin_bicycleOption.jsp">Bicycle Option</a> <a href="admin_memberInfo.jsp">Member Information</a> <a href="admin_comment.jsp">Comments Form</a> List<hr> <a href="list_retailer.jsp">Retailer</a> <a href="list_bicycleDetail.jsp">Detail</a> <a href="list_bicycleoption.jsp">Option</a> <a href="list_memberinfo.jsp">Member Info</a> <a href="list_comment.jsp">Comment</a> </td> <td width="750"><div id="l">Profile Name: < %=login.getMemberName()%>&nbsp;&nbsp;Member Email: &nbsp;< %=login.getEmail()%>&nbsp;&nbsp;<a href="logoutProcess.jsp">logout</a></div> <form action="editRetailerProccess.jsp" method="post"><fieldset> <legend><b>Retailer Form</b></legend><div id="c"> <table width="100%" cellspacing="10"> <tr> <td width="17%" id="l"><label>Retailer ID</label></td> <td width="2%" id="c">:</td> <td width="81%" id="l"><input name="Retailer_Id" type="text" size="40" value="<%=retailer.getRetailerID() %>"></td> </tr> <tr> <td id="l">Name</td> <td id="c">:</td> <td id="l"><input type="textfield" name="Retailer_Name" size="40" value="<%=retailer.getNameOfRetailer() %>"></td> </tr> Advanced Java June 2011 Final @NCC Education 2011
  62. 62. <tr><td id="l">Address</td> <td id="l">:</td> <td id="l"><input type="text" name="Address" size="40" value="<%=retailer.getPostalAddress() %>"></td></tr> <tr> <td id="l">E-Mail</td> <td id="l">:</td> <td id="l"><input type="text" name="Email" size="40" value="<%=retailer.getEmailAddress()%>"></td> </tr> <tr> <td id="l">Phone</td> <td id="l">:</td> <td id="l"><input type="text" name="Phone" size="40" value="<%=retailer.getPhoneNumber()%>"></td> </tr> <tr> <td colspan="4" id="c"><input type="submit" name="Submit" value="Submit"></td> </tr> <tr> <td colspan="4" id="c">&nbsp;</td> </tr> </table> </div></fieldset></form> <tr id="vl"> <td colspan="2" height="80" id="fotter">All right reserved by Bicycle Club &copy; right 2011</td></tr></table> </body> </html> admin_retailer.jsp <%@page import="bicycle.beans.BicycleDetail"%> <%@page import="bicycle.beans.MyEntityManager"%> <%@page import="java.util.Vector"%> <%@page import="bicycle.beans.*"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Bicycle</title> <link href="css/css.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ff6699"> <% Login login = (Login) session.getAttribute("login"); if (login == null) { response.sendRedirect("index.jsp"); Advanced Java June 2011 Final @NCC Education 2011

×