diff --git a/.gitignore b/.gitignore index eb5a316..f81245d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ -target +/CL-BSCSD-21-13/web-project/target/ +/CL-BSCSD-21-13/testautomation/nbproject/ +/CL-BSCSD-21-13/testautomation/target/ +/CL-BSCSD-21-13/bambalapitiya-web-service/target/ +/CL-BSCSD-21-13/JK-web-service/target/ +/CL-BSCSD-21-13/JK-web-client/target/ diff --git a/CL-BSC-SE-Sheehan/sample.md b/CL-BSC-SE-Sheehan/sample.md deleted file mode 100644 index dc24122..0000000 --- a/CL-BSC-SE-Sheehan/sample.md +++ /dev/null @@ -1 +0,0 @@ -sheehan De Zilva \ No newline at end of file diff --git a/CL-BSCSD-21-02/README.md b/CL-BSCSD-21-02/README.md deleted file mode 100644 index d0cbaa8..0000000 --- a/CL-BSCSD-21-02/README.md +++ /dev/null @@ -1 +0,0 @@ -Suween Deen \ No newline at end of file diff --git a/CL-BSCSD-21-02/mavenproject1/src/main/java/com/mycompany/mavenproject1/App.java b/CL-BSCSD-21-02/mavenproject1/src/main/java/com/mycompany/mavenproject1/App.java deleted file mode 100644 index 8395eb3..0000000 --- a/CL-BSCSD-21-02/mavenproject1/src/main/java/com/mycompany/mavenproject1/App.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package com.mycompany.mavenproject1; - - -public class App -{ - - public App() { - } - - public static void main(String args[]) - { - System.out.println("Helo World"); - //initializing 1 - int x[]=new int[3]; - - x[0]=10; - x[1]=20; - x[2]=30; - - - for(int y=0;y + + + + + 1.7-web + Tomcat + JDK_1.8 + http://localhost:8080/JK-web-service/JKWebService?wsdl + + + addCookie + getCookies + getParameter + href + randomUUID + redirectToLogin + SESID + sessionId + setAttribute + stylesheet + toString + toUpperCase + UUID + WebHelper + + diff --git a/CL-BSCSD-21-13/JK-web-client/pom.xml b/CL-BSCSD-21-13/JK-web-client/pom.xml new file mode 100644 index 0000000..3b04fa9 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + + sample + JK-web-client + 1.0-SNAPSHOT + war + + JK-web-client + + + ${project.build.directory}/endorsed + UTF-8 + + + + + mysql + mysql-connector-java + 6.0.6 + + + javax + javaee-web-api + 7.0 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + src + WEB-INF + + jax-ws-catalog.xml + wsdl/** + + + + src + WEB-INF/classes/META-INF + + jax-ws-catalog.xml + wsdl/** + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + javax + javaee-endorsed-api + 7.0 + jar + + + + + + + + org.jvnet.jax-ws-commons + jaxws-maven-plugin + 2.3 + + + + wsimport + + + + localhost_8080/JK-web-service/JKWebService.wsdl + + + + -Djavax.xml.accessExternalSchema=all + + http://localhost:8080/JK-web-service/JKWebService?wsdl + ${project.build.directory}/jaxws/stale/JKWebService_1.stale + + wsimport-generate-JKWebService_1 + generate-sources + + + + + javax.xml + webservices-api + 2.0 + + + + ${project.build.directory}/generated-sources/jaxws-wsimport + true + true + true + ${basedir}/src/jax-ws-catalog.xml + + + + + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/jax-ws-catalog.xml b/CL-BSCSD-21-13/JK-web-client/src/jax-ws-catalog.xml new file mode 100644 index 0000000..83ee532 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/jax-ws-catalog.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/java/jk/webclient/WebHelper.java b/CL-BSCSD-21-13/JK-web-client/src/main/java/jk/webclient/WebHelper.java new file mode 100644 index 0000000..da892f2 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/java/jk/webclient/WebHelper.java @@ -0,0 +1,71 @@ +package jk.webclient; + + +import java.io.IOException; +import java.util.List; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import jk.service.JKWebService; +import jk.service.JKWebService_Service; +import jk.service.User; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author Mohamed Ali + */ +public class WebHelper { + /*public static List getStudents() { + JKWebService_Service client = new JKWebService_Service(); + JKWebService proxy = client.getJKWebServicePort(); + List list = proxy.getStudents(); + return list; + }*/ + + public static User authenticate(String username, String password) { + User authenticatedUser = null; + + JKWebService_Service client = new JKWebService_Service(); + JKWebService proxy = client.getJKWebServicePort(); + User user = proxy.getUser(username); + + //Authenticated the users password + if (user != null && password.equals(user.getPassword())) { + authenticatedUser= user; + } + + return authenticatedUser; + } + + + public static User authenticate(Cookie[] cookies, HttpSession session) { + // Authenticate the user from cookie session + User user = null; + + // Iterate all the cookies from the client request + for (Cookie cookie : cookies) { + // Checks SESID cookie + if (cookie.getName().equals("SESID")) { + // Lookup SESID cookie value from sessions + Object sessionObj = session.getAttribute(cookie.getValue()); + + // Load the user from session object if it exists + if (sessionObj != null) { + user = (User)sessionObj; + } + } + } + return user; + } + + public static void redirectToLogin(HttpServletResponse response) throws IOException{ + response.sendRedirect("index.jsp"); + } + +} diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/META-INF/context.xml b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..28910d5 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/admin.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/admin.jsp new file mode 100644 index 0000000..427c97a --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/admin.jsp @@ -0,0 +1,35 @@ +<%-- + Document : admin + Created on : Feb 25, 2021, 6:12:12 PM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/createstock.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/createstock.jsp new file mode 100644 index 0000000..e9e2ed8 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/createstock.jsp @@ -0,0 +1,39 @@ +<%-- + Document : createstock + Created on : Feb 23, 2021, 10:57:16 PM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Create New Stock + + + + + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/headofficemainmenu.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/headofficemainmenu.jsp new file mode 100644 index 0000000..17e7ae9 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/headofficemainmenu.jsp @@ -0,0 +1,37 @@ +<%-- + Document : headofficemainmenu + Created on : Feb 24, 2021, 8:17:22 PM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + +
+
+ + + + + + + + + + + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/home.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/home.jsp new file mode 100644 index 0000000..fe340ce --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/home.jsp @@ -0,0 +1,58 @@ +<%-- + Document : home + Created on : Feb 26, 2021, 1:20:14 AM + Author : Mohamed Ali +--%> +<%@page import="java.util.UUID"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Branch Home + + + + +
+
+ + + + + User user = WebHelper.authenticate(request.getCookies(), session); + + if (user == null) { + String username = request.getParameter("username"); + String password = request.getParameter("password"); + + + if (username != null && password != null) { + + user = WebHelper.authenticate(username, password); + if (user != null) { + String sessionId = UUID.randomUUID().toString().replace("-", "").toUpperCase(); + // Create cookie and attach it to response + Cookie cookie = new Cookie("SESID", sessionId); + response.addCookie(cookie); + // Create session attribute + session.setAttribute(sessionId, user); + out.print("Welcome " + user.username()); + } else { + WebHelper.redirectToLogin(response); + } + } else { + WebHelper.redirectToLogin(response); + } + } else { + out.print("Welcome " + user.username()); + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/index.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/index.jsp new file mode 100644 index 0000000..67a2f54 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/index.jsp @@ -0,0 +1,51 @@ +<%-- + Document : index + Created on : Feb 21, 2021, 3:25:34 AM + Author : Mohamed Ali +--%> + +<%@page import="com.mysql.cj.core.util.Util"%> +<%@page import="java.util.List"%> +<%@page import="jk.service.User"%> +<%@page import="jk.service.JKWebService"%> +<%@page import="jk.service.JKWebService_Service"%> +<%@page import="java.util.Map.Entry"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + + + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/makesale.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/makesale.jsp new file mode 100644 index 0000000..b7ed467 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/makesale.jsp @@ -0,0 +1,34 @@ +<%-- + Document : makesale + Created on : Feb 26, 2021, 2:19:43 AM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Make Sale + + + +
+
+ + + + + +
+ + + + + + +
+ + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/receivestock.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/receivestock.jsp new file mode 100644 index 0000000..9b9a648 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/receivestock.jsp @@ -0,0 +1,33 @@ +<%-- + Document : receivestock + Created on : Feb 26, 2021, 1:49:05 AM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Received Request + + + +
+
+ + + + + +
+ + + + + +
+ + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/registrationpage.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/registrationpage.jsp new file mode 100644 index 0000000..7919248 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/registrationpage.jsp @@ -0,0 +1,40 @@ +<%-- + Document : registrationpage + Created on : Feb 23, 2021, 10:36:43 PM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Registration Page + + + +
+ + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/requeststock.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/requeststock.jsp new file mode 100644 index 0000000..f113aad --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/requeststock.jsp @@ -0,0 +1,36 @@ +<%-- + Document : requeststock + Created on : Feb 26, 2021, 2:14:20 AM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Request Stock + + + +
+
+ + + + + +
+ + + + + + + +
+ + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/resgistercustomer.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/resgistercustomer.jsp new file mode 100644 index 0000000..a2ba5eb --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/resgistercustomer.jsp @@ -0,0 +1,35 @@ +<%-- + Document : resgistercustomer + Created on : Feb 26, 2021, 2:13:57 AM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Customer Registration + + + +
+
+ + + + + +
+ + + + + + +
+ + + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/style.css b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/style.css new file mode 100644 index 0000000..e2e4931 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/style.css @@ -0,0 +1,272 @@ +/* +To change this license header, choose License Headers in Project Properties. +To change this template file, choose Tools | Templates +and open the template in the editor. +*/ +/* + Created on : Feb 23, 2021, 10:08:33 PM + Author : Mohamed Ali +*/ + + +/* BASIC */ + +html { + background-color: #99ddff; +} + +body { + font-family: "Poppins", sans-serif; + height: 100vh; +} + +a { + color: #92badd; + display:inline-block; + text-decoration: none; + font-weight: 400; +} + +h2 { + text-align: center; + font-size: 16px; + font-weight: 600; + text-transform: uppercase; + display:inline-block; + margin: 40px 8px 10px 8px; + color: #cccccc; +} + + + +/* STRUCTURE */ + +.wrapper { + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + width: 100%; + min-height: 100%; + padding: 20px; +} + +#formContent { + -webkit-border-radius: 10px 10px 10px 10px; + border-radius: 10px 10px 10px 10px; + background: #fff; + padding: 30px; + width: 90%; + max-width: 450px; + position: relative; + padding: 0px; + -webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3); + box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3); + text-align: center; +} + +#formFooter { + background-color: #f6f6f6; + border-top: 1px solid #dce8f1; + padding: 25px; + text-align: center; + -webkit-border-radius: 0 0 10px 10px; + border-radius: 0 0 10px 10px; +} + + + +/* TABS */ + +h2.inactive { + color: #cccccc; +} + +h2.active { + color: #0d0d0d; + border-bottom: 2px solid #5fbae9; +} + + + +/* FORM TYPOGRAPHY*/ + +input[type=button], input[type=submit], input[type=reset] { + background-color: #56baed; + border: none; + color: white; + padding: 15px 80px; + text-align: center; + text-decoration: none; + display: inline-block; + text-transform: uppercase; + font-size: 13px; + -webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4); + box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4); + -webkit-border-radius: 5px 5px 5px 5px; + border-radius: 5px 5px 5px 5px; + margin: 5px 20px 40px 20px; + -webkit-transition: all 0.3s ease-in-out; + -moz-transition: all 0.3s ease-in-out; + -ms-transition: all 0.3s ease-in-out; + -o-transition: all 0.3s ease-in-out; + transition: all 0.3s ease-in-out; +} + +input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover input[type=onclick]:hover { + background-color: #39ace7; +} + +input[type=button]:active, input[type=submit]:active, input[type=reset]:active, input[type=onclick] { + -moz-transform: scale(0.95); + -webkit-transform: scale(0.95); + -o-transform: scale(0.95); + -ms-transform: scale(0.95); + transform: scale(0.95); +} + +input[type=text], input[type=password] { + background-color: #f6f6f6; + border: none; + color: #0d0d0d; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 5px; + width: 85%; + border: 2px solid #f6f6f6; + -webkit-transition: all 0.5s ease-in-out; + -moz-transition: all 0.5s ease-in-out; + -ms-transition: all 0.5s ease-in-out; + -o-transition: all 0.5s ease-in-out; + transition: all 0.5s ease-in-out; + -webkit-border-radius: 5px 5px 5px 5px; + border-radius: 5px 5px 5px 5px; +} + +input[type=text]:focus, input[type=password]{ + background-color: #fff; + border-bottom: 2px solid #5fbae9; +} + +input[type=text]:placeholder { + color: #cccccc; +} + + + +/* ANIMATIONS */ + +/* Simple CSS3 Fade-in-down Animation */ +.fadeInDown { + -webkit-animation-name: fadeInDown; + animation-name: fadeInDown; + -webkit-animation-duration: 1s; + animation-duration: 1s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +@-webkit-keyframes fadeInDown { + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + 100% { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInDown { + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + 100% { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +/* Simple CSS3 Fade-in Animation */ +@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } } +@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } } +@keyframes fadeIn { from { opacity:0; } to { opacity:1; } } + +.fadeIn { + opacity:0; + -webkit-animation:fadeIn ease-in 1; + -moz-animation:fadeIn ease-in 1; + animation:fadeIn ease-in 1; + + -webkit-animation-fill-mode:forwards; + -moz-animation-fill-mode:forwards; + animation-fill-mode:forwards; + + -webkit-animation-duration:1s; + -moz-animation-duration:1s; + animation-duration:1s; +} + +.fadeIn.first { + -webkit-animation-delay: 0.4s; + -moz-animation-delay: 0.4s; + animation-delay: 0.4s; +} + +.fadeIn.second { + -webkit-animation-delay: 0.6s; + -moz-animation-delay: 0.6s; + animation-delay: 0.6s; +} + +.fadeIn.third { + -webkit-animation-delay: 0.8s; + -moz-animation-delay: 0.8s; + animation-delay: 0.8s; +} + +.fadeIn.fourth { + -webkit-animation-delay: 1s; + -moz-animation-delay: 1s; + animation-delay: 1s; +} + +/* Simple CSS3 Fade-in Animation */ +.underlineHover:after { + display: block; + left: 0; + bottom: -10px; + width: 0; + height: 2px; + background-color: #56baed; + content: ""; + transition: width 0.2s; +} + +.underlineHover:hover { + color: #0d0d0d; +} + +.underlineHover:hover:after{ + width: 100%; +} + + + +/* OTHERS */ + +*:focus { + outline: none; +} + +#icon { + width:60%; +} diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/totalsales.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/totalsales.jsp new file mode 100644 index 0000000..be2dacc --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/totalsales.jsp @@ -0,0 +1,33 @@ +<%-- + Document : totalsales + Created on : Feb 26, 2021, 1:51:19 AM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Total Sales + + + +
+
+ + + + + +
+ + + + + +
+ + diff --git a/CL-BSCSD-21-13/JK-web-client/src/main/webapp/transportroute.jsp b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/transportroute.jsp new file mode 100644 index 0000000..633ff34 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/main/webapp/transportroute.jsp @@ -0,0 +1,34 @@ +<%-- + Document : tranportroute + Created on : Feb 26, 2021, 1:51:59 AM + Author : Mohamed Ali +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Transport Route + + + +
+
+ + + + + +
+ + + + + + +
+ + diff --git a/CL-BSCSD-21-13/JK-web-client/src/wsdl/localhost_8080/JK-web-service/JKWebService.wsdl b/CL-BSCSD-21-13/JK-web-client/src/wsdl/localhost_8080/JK-web-service/JKWebService.wsdl new file mode 100644 index 0000000..e062b73 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/wsdl/localhost_8080/JK-web-service/JKWebService.wsdl @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CL-BSCSD-21-13/JK-web-client/src/wsdl/localhost_8080/JK-web-service/JKWebService.xsd_1.xsd b/CL-BSCSD-21-13/JK-web-client/src/wsdl/localhost_8080/JK-web-service/JKWebService.xsd_1.xsd new file mode 100644 index 0000000..ca45361 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-client/src/wsdl/localhost_8080/JK-web-service/JKWebService.xsd_1.xsd @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CL-BSCSD-21-13/JK-web-service/nb-configuration.xml b/CL-BSCSD-21-13/JK-web-service/nb-configuration.xml new file mode 100644 index 0000000..4008e6a --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/nb-configuration.xml @@ -0,0 +1,28 @@ + + + + + + + 1.8-web + Tomcat + JDK_1.8 + /less:/css + false + false + + + /scss:/css + js/libs + + diff --git a/CL-BSCSD-21-13/JK-web-service/pom.xml b/CL-BSCSD-21-13/JK-web-service/pom.xml new file mode 100644 index 0000000..8d3a3bd --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/pom.xml @@ -0,0 +1,86 @@ + + + 4.0.0 + + sample + JK-web-service + 1.0-SNAPSHOT + war + + JK-web-service + + + ${project.build.directory}/endorsed + UTF-8 + + + + + org.glassfish.metro + webservices-rt + 2.3 + + + mysql + mysql-connector-java + 6.0.6 + + + javax + javaee-web-api + 7.0 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + javax + javaee-endorsed-api + 7.0 + jar + + + + + + + + + + diff --git a/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/JKWebService.java b/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/JKWebService.java new file mode 100644 index 0000000..0d52346 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/JKWebService.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package JK.service; + +import java.util.List; +import javax.jws.WebService; +import javax.jws.WebMethod; +import javax.jws.WebParam; + +/** + * + * @author Mohamed Ali + */ +@WebService(serviceName = "JKWebService") +public class JKWebService { + + /** + * This is a sample web service operation + * @param txt + * @return + */ + @WebMethod(operationName = "hello") + public String hello(@WebParam(name = "name") String txt) { + return "Hi " + txt + " !!!"; + } + + @WebMethod(operationName = "getUser") + public User getUser(@WebParam(name = "username") String username) { + User st = Util.getUser(username); + return st; + } + + @WebMethod(operationName = "getUsers") + public List getUsers() { + List users = Util.getUsers(); + return users; + } + + + @WebMethod(operationName = "addUser") + public boolean addUser(@WebParam(name = "user") User user) { + //This should be inserted to DB + return true; + } + + + @WebMethod(operationName = "updateUser") + public boolean updateUser(@WebParam(name = "user") User user) { + //This should be inserted to DB + return true; + } + + @WebMethod(operationName = "deleteUser") + public boolean deleteUser(@WebParam(name = "username") String username) { + return true; + } +} diff --git a/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/User.java b/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/User.java new file mode 100644 index 0000000..5ffba34 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/User.java @@ -0,0 +1,87 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package JK.service; + +/** + * + * @author Mohamed Ali + */ +public class User { + + private String username; + + private String useraddress; + + private String phone; + + private String email; + + private String password; + + public User() { + this.username = ""; + this.useraddress = ""; + this.phone = ""; + this.email = ""; + this.password = ""; + } + + public User(String branchid, String branchname, String branchaddress, String branchemail, String branchpassword){ + this.username = branchid; + this.useraddress = branchname; + this.phone = branchaddress; + this.email = branchemail; + this.password = branchpassword; + + + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUseraddress() { + return useraddress; + } + + public void setUseraddress(String useraddress) { + this.useraddress = useraddress; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + +} + + + + diff --git a/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/Util.java b/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/Util.java new file mode 100644 index 0000000..0484186 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/src/main/java/JK/service/Util.java @@ -0,0 +1,206 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package JK.service; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Mohamed Ali + */ +public class Util { + + static final String DB_URL = "jdbc:mysql://localhost:3306/jk-salessystem"; + static final String USER = "root"; + static final String PASS = "root"; + + public static List getUsers() { + List users = new ArrayList<>(); + Connection conn = null; + Statement stmt = null; + try{ + Class.forName("com.mysql.jdbc.Driver"); + conn = DriverManager.getConnection(DB_URL, USER, PASS); + stmt = (Statement) conn.createStatement(); + String sql = "SELECT * FROM branch"; + ResultSet rs = stmt.executeQuery(sql); + while(rs.next()){ + + User user = new User(); + user.setUsername(rs.getString("username")); + user.setUseraddress(rs.getString("useraddress")); + user.setPhone(rs.getString("phone")); + user.setEmail(rs.getString("email")); + user.setPassword(rs.getString("password")); + + users.add(user); + } + rs.close(); + }catch(SQLException se){ + se.printStackTrace(); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if(stmt!=null) + conn.close(); + }catch(SQLException se){ + } + try{ + if(conn!=null) + conn.close(); + }catch(SQLException se){ + se.printStackTrace(); + } + } + return users; + } + + + public static User getUser(String username) { + User user = null; + Connection conn = null; + Statement stmt = null; + try{ + Class.forName("com.mysql.jdbc.Driver"); + conn = DriverManager.getConnection(DB_URL, USER, PASS); + stmt = (Statement) conn.createStatement(); + String sql = "SELECT * FROM users WHERE username='" + username + "'"; + ResultSet rs = stmt.executeQuery(sql); + while(rs.next()){ + user = new User(); + user.setUsername(rs.getString("username")); + user.setUseraddress(rs.getString("useraddress")); + user.setPhone(rs.getString("phone")); + user.setEmail(rs.getString("email")); + user.setPassword(rs.getString("password")); + } + rs.close(); + }catch(SQLException se){ + se.printStackTrace(); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if(stmt!=null) + conn.close(); + }catch(SQLException se){ + } + try{ + if(conn!=null) + conn.close(); + }catch(SQLException se){ + se.printStackTrace(); + } + } + return user; + } + + public static boolean addUser(User user) { + Connection conn = null; + Statement stmt = null; + try{ + Class.forName("com.mysql.jdbc.Driver"); + conn = DriverManager.getConnection(DB_URL, USER, PASS); + stmt = (Statement) conn.createStatement(); + String sql = "INSERT INTO users " + + "(`username`, `useraddress`, `phone`, `email`,`password`) " + + "VALUES ('" + user.getUsername()+ "', '"+ user.getUseraddress()+"', '"+ user.getPhone()+"','"+ user.getEmail()+"', '"+ user.getPassword()+"')"; + stmt.executeUpdate(sql); + return true; + }catch(SQLException se){ + se.printStackTrace(); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if(stmt!=null) + conn.close(); + }catch(SQLException se){ + } + try{ + if(conn!=null) + conn.close(); + }catch(SQLException se){ + se.printStackTrace(); + } + } + return false; + } + + public static boolean updateUser(User user) { + Connection conn = null; + Statement stmt = null; + try{ + Class.forName("com.mysql.jdbc.Driver"); + conn = DriverManager.getConnection(DB_URL, USER, PASS); + stmt = (Statement) conn.createStatement(); + String sql = "UPDATE `users` " + + "SET `username` = '" + user.getUsername()+ "', " + + "`useraddress` = '" + user.getUseraddress()+ "'," + + "`phone` = '" + user.getPhone()+"'," + + "`email` = '" + user.getEmail()+"'," + + "`password` = '" + user.getPassword()+"'," + + " WHERE (`users` = '" + user.getUsername()+"')"; + stmt.executeUpdate(sql); + return true; + }catch(SQLException se){ + se.printStackTrace(); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if(stmt!=null) + conn.close(); + }catch(SQLException se){ + } + try{ + if(conn!=null) + conn.close(); + }catch(SQLException se){ + se.printStackTrace(); + } + } + return false; + } + + public static boolean deleteUser(String username) { + Connection conn = null; + Statement stmt = null; + try{ + Class.forName("com.mysql.jdbc.Driver"); + conn = DriverManager.getConnection(DB_URL, USER, PASS); + stmt = (Statement) conn.createStatement(); + String sql = "DELETE FROM `users` WHERE (`username` = '" + username + "')"; + stmt.executeUpdate(sql); + return true; + }catch(SQLException se){ + se.printStackTrace(); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if(stmt!=null) + conn.close(); + }catch(SQLException se){ + } + try{ + if(conn!=null) + conn.close(); + }catch(SQLException se){ + se.printStackTrace(); + } + } + return false; + } + +} diff --git a/CL-BSCSD-21-13/JK-web-service/src/main/webapp/META-INF/context.xml b/CL-BSCSD-21-13/JK-web-service/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..f414faf --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/CL-BSCSD-21-13/JK-web-service/src/main/webapp/WEB-INF/sun-jaxws.xml b/CL-BSCSD-21-13/JK-web-service/src/main/webapp/WEB-INF/sun-jaxws.xml new file mode 100644 index 0000000..15ba593 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/src/main/webapp/WEB-INF/sun-jaxws.xml @@ -0,0 +1,4 @@ + + + + diff --git a/CL-BSCSD-21-13/JK-web-service/src/main/webapp/WEB-INF/web.xml b/CL-BSCSD-21-13/JK-web-service/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..035afb2 --- /dev/null +++ b/CL-BSCSD-21-13/JK-web-service/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,20 @@ + + + + com.sun.xml.ws.transport.http.servlet.WSServletContextListener + + + JKWebService + com.sun.xml.ws.transport.http.servlet.WSServlet + 1 + + + JKWebService + /JKWebService + + + + 30 + + + diff --git a/CL-BSCSD-21-13/bambalapitiya-web-service/nb-configuration.xml b/CL-BSCSD-21-13/bambalapitiya-web-service/nb-configuration.xml new file mode 100644 index 0000000..cd0068d --- /dev/null +++ b/CL-BSCSD-21-13/bambalapitiya-web-service/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + 1.7-web + Tomcat + + diff --git a/CL-BSCSD-21-13/bambalapitiya-web-service/pom.xml b/CL-BSCSD-21-13/bambalapitiya-web-service/pom.xml new file mode 100644 index 0000000..383626f --- /dev/null +++ b/CL-BSCSD-21-13/bambalapitiya-web-service/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + sample + bambalapitiya-web-service + 1.0-SNAPSHOT + war + + bambalapitiya-web-service + + + ${project.build.directory}/endorsed + UTF-8 + + + + + javax + javaee-web-api + 7.0 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + javax + javaee-endorsed-api + 7.0 + jar + + + + + + + + + + diff --git a/CL-BSCSD-21-13/bambalapitiya-web-service/src/main/webapp/META-INF/context.xml b/CL-BSCSD-21-13/bambalapitiya-web-service/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..1ff15bd --- /dev/null +++ b/CL-BSCSD-21-13/bambalapitiya-web-service/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/CL-BSCSD-21-13/bambalapitiya-web-service/src/main/webapp/index.html b/CL-BSCSD-21-13/bambalapitiya-web-service/src/main/webapp/index.html new file mode 100644 index 0000000..3368e9c --- /dev/null +++ b/CL-BSCSD-21-13/bambalapitiya-web-service/src/main/webapp/index.html @@ -0,0 +1,10 @@ + + + + Start Page + + + +

Hello World!

+ + diff --git a/CL-BSCSD-21-02/mavenproject1/pom.xml b/CL-BSCSD-21-13/mavenproject1/pom.xml similarity index 82% rename from CL-BSCSD-21-02/mavenproject1/pom.xml rename to CL-BSCSD-21-13/mavenproject1/pom.xml index d2b5e94..083fc6a 100644 --- a/CL-BSCSD-21-02/mavenproject1/pom.xml +++ b/CL-BSCSD-21-13/mavenproject1/pom.xml @@ -7,7 +7,7 @@ jar UTF-8 - 11 - 11 + 15 + 15 \ No newline at end of file diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/App/App.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/App/App.java new file mode 100644 index 0000000..431c106 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/App/App.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package App; + +import db.DBUtil; +import db.MySQLUtils; +/** + * + * @author Mohamed Ali + */ +public class App { + public static void main (String [] args){ + DBUtil utl = new MySQLUtils(); + + process p1 = new process(); + p1.process(utl); + } + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/App/process.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/App/process.java new file mode 100644 index 0000000..2ada126 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/App/process.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package App; + +import db.DBUtil; + +/** + * + * @author Mohamed Ali + */ +public class process { + public void process(DBUtil util){ + util.addStudents(); + util.updateStudent(); + } + + +} diff --git a/tharik/myproject/src/main/java/newpackage/App.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/com/mycompany/mavenproject1/App.java similarity index 54% rename from tharik/myproject/src/main/java/newpackage/App.java rename to CL-BSCSD-21-13/mavenproject1/src/main/java/com/mycompany/mavenproject1/App.java index 335f220..16cb756 100644 --- a/tharik/myproject/src/main/java/newpackage/App.java +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/com/mycompany/mavenproject1/App.java @@ -3,15 +3,15 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package newpackage; +package com.mycompany.mavenproject1; /** * - * @author tharik + * @author Mohamed Ali */ public class App { - public static void main(String[] args) { - Student st = new Student("ST01", "John", "Smith"); - System.out.println(st.getFullName()); + + public static void main(String [] args){ + System.out.println("Hello World"); } } diff --git a/tharik/myproject/src/main/java/org/icbt/myproject/Student.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/com/mycompany/mavenproject1/Student.java similarity index 57% rename from tharik/myproject/src/main/java/org/icbt/myproject/Student.java rename to CL-BSCSD-21-13/mavenproject1/src/main/java/com/mycompany/mavenproject1/Student.java index 30a2b2a..a3a0114 100644 --- a/tharik/myproject/src/main/java/org/icbt/myproject/Student.java +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/com/mycompany/mavenproject1/Student.java @@ -3,16 +3,13 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package org.icbt.myproject; +package com.mycompany.mavenproject1; /** * - * @author tharik + * @author Mohamed Ali */ public class Student { - public static final String STUDENT_CODE = "ST"; - public String firstName = "John"; - public String lastName = "Smith"; } diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/db/DBUtil.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/db/DBUtil.java new file mode 100644 index 0000000..5d7f51d --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/db/DBUtil.java @@ -0,0 +1,25 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package db; + +/** + * + * @author Mohamed Ali + */ +public interface DBUtil { + public void readStudents(); + + public void addStudents(); + + public void updateStudents(); + + public void deleteStudents(); + + public void updateStudent(); + + + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/db/MySQLUtils.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/db/MySQLUtils.java new file mode 100644 index 0000000..198afce --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/db/MySQLUtils.java @@ -0,0 +1,40 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package db; + +/** + * + * @author Mohamed Ali + */ +public class MySQLUtils implements DBUtil { + + @Override + public void readStudents() { + System.out.println("Reading students from MSQL DB"); + } + + @Override + public void addStudents() { + System.out.println("Add students from MYSQL DB"); + } + + @Override + public void updateStudents() { + System.out.println("update students from MSQL DB"); + } + + @Override + public void deleteStudents() { + System.out.println("delete student from MYSQL DB"); + } + + @Override + public void updateStudent() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/db/OracleUtil.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/db/OracleUtil.java new file mode 100644 index 0000000..96e529c --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/db/OracleUtil.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package db; + +/** + * + * @author Mohamed Ali + */ +public class OracleUtil implements DBUtil { + @Override + public void readStudents() { + System.out.println("Reading students from Oracle"); + } + + @Override + public void addStudents() { + System.out.println("Add students from Oracle"); + } + + @Override + public void updateStudents() { + System.out.println("update students from Oracle"); + } + + @Override + public void deleteStudents() { + System.out.println("delete student from Oracle"); + } + + @Override + public void updateStudent() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Animal.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Animal.java new file mode 100644 index 0000000..e3c63c7 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Animal.java @@ -0,0 +1,17 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package newpackage2; + +/** + * + * @author Mohamed Ali + */ +public interface Animal { + public void move(); + + public void consume(); + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/App.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/App.java new file mode 100644 index 0000000..324f243 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/App.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package newpackage2; + +/** + * + * @author Mohamed Ali + */ +public class App { + public static void main(String [] args){ + Animal animal1 = new Dog(); + Animal animal2 = new Cat(); + + animal1.move(); + animal2.consume(); + } + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Cat.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Cat.java new file mode 100644 index 0000000..d8d002f --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Cat.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package newpackage2; + +/** + * + * @author Mohamed Ali + */ +public class Cat implements Animal{ + @Override + public void move(){ + System.out.println("Cat is moving"); + } + @Override + public void consume(){ + System.out.println("Cat is comsuming"); + } + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Dog.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Dog.java new file mode 100644 index 0000000..af719f2 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/newpackage2/Dog.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package newpackage2; + +/** + * + * @author Mohamed Ali + */ +public class Dog implements Animal{ + @Override + public void move(){ + System.out.println("Dog is moving"); + } + @Override + public void consume(){ + System.out.println("Dog is comsuming"); + } + +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/App.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/App.java new file mode 100644 index 0000000..6903dc7 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/App.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package package1; + +/** + * + * @author Mohamed Ali + */ +public class App { + public static void main (String[] args) { + + Person[] persons = new Person[4]; + + //Person[0] = new Student("ST01","John","Smith"); + + } +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/Person.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/Person.java new file mode 100644 index 0000000..53ce263 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/Person.java @@ -0,0 +1,30 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package package1; + +/** + * + * @author Mohamed Ali + */ +class Person { + private String firstname; + private String lastname; + + public String getFirstname() { + return this.firstname; + } + + public void setFirstname (String firstname){ + this.firstname = firstname; + } + public String getLastname (){ + return lastname; + } + + public void setLastname (String lastname){ + this.lastname = lastname; + } +} diff --git a/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/Student.java b/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/Student.java new file mode 100644 index 0000000..14ac252 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/src/main/java/package1/Student.java @@ -0,0 +1,40 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package package1; + +/** + * + * @author Mohamed Ali + */ +public class Student extends Person { + private String id; + private String firstname; + private String lastname; + + public String getFirstname() { + return this.firstname; + } + + public void setFirstname (String firstname){ + this.firstname = firstname; + } + public String getLastname (){ + return lastname; + } + + public void setLastname (String lastname){ + this.lastname = lastname; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/App/App.class b/CL-BSCSD-21-13/mavenproject1/target/classes/App/App.class new file mode 100644 index 0000000..b7a0c02 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/App/App.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/App/process.class b/CL-BSCSD-21-13/mavenproject1/target/classes/App/process.class new file mode 100644 index 0000000..f0a313e Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/App/process.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/com/mycompany/mavenproject1/App.class b/CL-BSCSD-21-13/mavenproject1/target/classes/com/mycompany/mavenproject1/App.class new file mode 100644 index 0000000..3021e3c Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/com/mycompany/mavenproject1/App.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/com/mycompany/mavenproject1/Student.class b/CL-BSCSD-21-13/mavenproject1/target/classes/com/mycompany/mavenproject1/Student.class new file mode 100644 index 0000000..fd4c373 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/com/mycompany/mavenproject1/Student.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/db/DBUtil.class b/CL-BSCSD-21-13/mavenproject1/target/classes/db/DBUtil.class new file mode 100644 index 0000000..2d80940 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/db/DBUtil.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/db/MySQLUtils.class b/CL-BSCSD-21-13/mavenproject1/target/classes/db/MySQLUtils.class new file mode 100644 index 0000000..8e964aa Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/db/MySQLUtils.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/db/OracleUtil.class b/CL-BSCSD-21-13/mavenproject1/target/classes/db/OracleUtil.class new file mode 100644 index 0000000..62316a0 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/db/OracleUtil.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Animal.class b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Animal.class new file mode 100644 index 0000000..80fb664 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Animal.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/App.class b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/App.class new file mode 100644 index 0000000..a136958 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/App.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Cat.class b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Cat.class new file mode 100644 index 0000000..fbe14ba Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Cat.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Dog.class b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Dog.class new file mode 100644 index 0000000..613d8c0 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/newpackage2/Dog.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/package1/App.class b/CL-BSCSD-21-13/mavenproject1/target/classes/package1/App.class new file mode 100644 index 0000000..fdc4665 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/package1/App.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/package1/Person.class b/CL-BSCSD-21-13/mavenproject1/target/classes/package1/Person.class new file mode 100644 index 0000000..64f2687 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/package1/Person.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/classes/package1/Student.class b/CL-BSCSD-21-13/mavenproject1/target/classes/package1/Student.class new file mode 100644 index 0000000..27f26e7 Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/classes/package1/Student.class differ diff --git a/CL-BSCSD-21-13/mavenproject1/target/maven-archiver/pom.properties b/CL-BSCSD-21-13/mavenproject1/target/maven-archiver/pom.properties new file mode 100644 index 0000000..7ee709e --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Sat Feb 20 21:47:11 IST 2021 +groupId=com.mycompany +artifactId=mavenproject1 +version=1.0-SNAPSHOT diff --git a/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..2ec7498 --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,14 @@ +App\App.class +App\process.class +com\mycompany\mavenproject1\App.class +newpackage2\App.class +newpackage2\Dog.class +package1\App.class +com\mycompany\mavenproject1\Student.class +db\MySQLUtils.class +db\DBUtil.class +newpackage2\Animal.class +package1\Person.class +db\OracleUtil.class +newpackage2\Cat.class +package1\Student.class diff --git a/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..95f50bf --- /dev/null +++ b/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,14 @@ +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\App\App.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\package1\Person.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\App\process.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\db\DBUtil.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\com\mycompany\mavenproject1\App.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\package1\Student.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\newpackage2\Animal.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\db\OracleUtil.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\db\MySQLUtils.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\newpackage2\App.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\com\mycompany\mavenproject1\Student.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\newpackage2\Dog.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\newpackage2\Cat.java +D:\icbt\icbt-bambalapitiya\CL-BSCSD-21-13\mavenproject1\src\main\java\package1\App.java diff --git a/CL-BSCSD-21-02/mavenproject1/target/classes/.netbeans_automatic_build b/CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst similarity index 100% rename from CL-BSCSD-21-02/mavenproject1/target/classes/.netbeans_automatic_build rename to CL-BSCSD-21-13/mavenproject1/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst diff --git a/CL-BSCSD-21-13/mavenproject1/target/mavenproject1-1.0-SNAPSHOT.jar b/CL-BSCSD-21-13/mavenproject1/target/mavenproject1-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..07077fd Binary files /dev/null and b/CL-BSCSD-21-13/mavenproject1/target/mavenproject1-1.0-SNAPSHOT.jar differ diff --git a/CL-BSCSD-21-13/testautomation/pom.xml b/CL-BSCSD-21-13/testautomation/pom.xml new file mode 100644 index 0000000..47478c2 --- /dev/null +++ b/CL-BSCSD-21-13/testautomation/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + com.mycompany + testautomation + 1.0-SNAPSHOT + jar + + + org.junit.jupiter + junit-jupiter-api + 5.6.0 + test + + + org.junit.jupiter + junit-jupiter-params + 5.6.0 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.6.0 + test + + + + UTF-8 + 15 + 15 + + \ No newline at end of file diff --git a/CL-BSCSD-21-13/testautomation/src/main/java/com/mycompany/testautomation/calculator.java b/CL-BSCSD-21-13/testautomation/src/main/java/com/mycompany/testautomation/calculator.java new file mode 100644 index 0000000..248f2cf --- /dev/null +++ b/CL-BSCSD-21-13/testautomation/src/main/java/com/mycompany/testautomation/calculator.java @@ -0,0 +1,25 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.testautomation; + +/** + * + * @author Mohamed Ali + */ +public class calculator { + public static int add(int no1, int no2){ + return no1+ no2; + } + public static int sub(int no1, int no2){ + return no1-no2; + } + public static int mutiply(int no1, int no2){ + return no1*no2; + } + public static int divid(int no1, int no2){ + return no1/no2; + } +} diff --git a/CL-BSCSD-21-13/testautomation/src/test/java/com/mycompany/testautomation/calculatorTest.java b/CL-BSCSD-21-13/testautomation/src/test/java/com/mycompany/testautomation/calculatorTest.java new file mode 100644 index 0000000..f75e48f --- /dev/null +++ b/CL-BSCSD-21-13/testautomation/src/test/java/com/mycompany/testautomation/calculatorTest.java @@ -0,0 +1,96 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.testautomation; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +/** + * + * @author Mohamed Ali + */ +public class calculatorTest { + + public calculatorTest() { + } + + @BeforeAll + public static void setUpClass() { + } + + @AfterAll + public static void tearDownClass() { + } + + @BeforeEach + public void setUp() { + } + + @AfterEach + public void tearDown() { + } + + /** + * Test of add method, of class calculator. + */ + @Test + public void testAdd() { + System.out.println("add"); + int no1 = 3; + int no2 = 5; + int expResult = 8; + int result = calculator.add(no1, no2); + assertEquals(expResult, result); + + } + + /** + * Test of sub method, of class calculator. + */ + @Test + public void testSub() { + System.out.println("sub"); + int no1 = 8; + int no2 = 3; + int expResult = 5; + int result = calculator.sub(no1, no2); + assertEquals(expResult, result); + + } + + /** + * Test of mutiply method, of class calculator. + */ + @Test + public void testMutiply() { + System.out.println("mutiply"); + int no1 = 3; + int no2 = 4; + int expResult = 12; + int result = calculator.mutiply(no1, no2); + assertEquals(expResult, result); + + } + + /** + * Test of divid method, of class calculator. + */ + @Test + public void testDivid() { + System.out.println("divid"); + int no1 = 8; + int no2 = 4; + int expResult = 2; + int result = calculator.divid(no1, no2); + assertEquals(expResult, result); + + } + +} diff --git a/CL-BSCSD-21-13/web-project/nb-configuration.xml b/CL-BSCSD-21-13/web-project/nb-configuration.xml new file mode 100644 index 0000000..cd0068d --- /dev/null +++ b/CL-BSCSD-21-13/web-project/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + 1.7-web + Tomcat + + diff --git a/CL-BSCSD-21-13/web-project/pom.xml b/CL-BSCSD-21-13/web-project/pom.xml new file mode 100644 index 0000000..d1e7dfb --- /dev/null +++ b/CL-BSCSD-21-13/web-project/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + com.mycompany + web-project + 1.0-SNAPSHOT + war + + web-project + + + ${project.build.directory}/endorsed + UTF-8 + + + + + javax + javaee-web-api + 7.0 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + javax + javaee-endorsed-api + 7.0 + jar + + + + + + + + + + diff --git a/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/Student.java b/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/Student.java new file mode 100644 index 0000000..da86715 --- /dev/null +++ b/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/Student.java @@ -0,0 +1,55 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.web.project; + +/** + * + * @author Mohamed Ali + */ +public class Student { + private String id; + private String name; + private String nic; + + public Student() { + this.id = ""; + this.name = ""; + this.nic = ""; + } + + public Student(String id, String name, String nic) { + this.id = id; + this.name = name; + this.nic = nic; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNic() { + return nic; + } + + public void setNic(String nic) { + this.nic = nic; + } + + + +} diff --git a/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/WebHelper.java b/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/WebHelper.java new file mode 100644 index 0000000..be7050f --- /dev/null +++ b/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/WebHelper.java @@ -0,0 +1,79 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.web.project; + +import java.io.IOException; +import java.net.http.HttpResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServlet; +import javax.websocket.Session; + +/** + * + * @author Mohamed Ali + */ +public class WebHelper { + + public static Student[] getStudent() { + + Student [] students = new Student[3]; + + students[0] = new Student("ST001", "John", "123V"); + students[1] = new Student("ST002", "George", "456V"); + students[2] = new Student("ST002", "James", "789V"); + + return students; + } + + public static String getgreeting(){ + String name = "Geroge"; + String greeting = "Hello"; + return greeting + " " + name; + } + + public static user authenticate(String username, String password) { + user authenticatedUser = null; + + //This should loaded from the DB + user user = new user("admin", "John", "Smith", "admin123"); + + //Authenticated the users password + if (username.equals(user.getUsername()) && password.equals(user.getPassword())) { + authenticatedUser= user; + } + + return authenticatedUser; + } + + + public static user authenticate(Cookie[] cookies, HttpSession session) { + // Authenticate the user from cookie session + user user = null; + + // Iterate all the cookies from the client request + for (Cookie cookie : cookies) { + // Checks SESID cookie + if (cookie.getName().equals("SESID")) { + // Lookup SESID cookie value from sessions + Object sessionObj = session.getAttribute(cookie.getValue()); + + // Load the user from session object if it exists + if (sessionObj != null) { + user = (user)sessionObj; + } + } + } + return user; + } + + public static void redirectToLogin(HttpServletResponse response) throws IOException{ + response.sendRedirect("login.jsp"); + } + +} diff --git a/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/user.java b/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/user.java new file mode 100644 index 0000000..aa9945e --- /dev/null +++ b/CL-BSCSD-21-13/web-project/src/main/java/com/mycompany/web/project/user.java @@ -0,0 +1,66 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.web.project; + +/** + * + * @author Mohamed Ali + */ +public class user { + private String username; + + private String firstname; + + private String lastname; + + private String password; + + public user(){ + this.username = ""; + this.firstname = ""; + this.lastname = ""; + this.password = ""; + } + public user(String username, String firstname, String lastname, String password){ + this.username = username; + this.firstname = firstname; + this.lastname = lastname; + this.password = password; + } + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + +} diff --git a/CL-BSCSD-21-13/web-project/src/main/webapp/META-INF/context.xml b/CL-BSCSD-21-13/web-project/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..0ad359d --- /dev/null +++ b/CL-BSCSD-21-13/web-project/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/CL-BSCSD-21-13/web-project/src/main/webapp/home.jsp b/CL-BSCSD-21-13/web-project/src/main/webapp/home.jsp new file mode 100644 index 0000000..c4cc038 --- /dev/null +++ b/CL-BSCSD-21-13/web-project/src/main/webapp/home.jsp @@ -0,0 +1,52 @@ +<%-- + Document : home + Created on : Dec 29, 2020, 9:11:43 AM + Author : Mohamed Ali +--%> + + + +<%@page import="com.mycompany.web.project.user"%> +<%@page import="java.util.UUID"%> +<%@page import="com.mycompany.web.project.WebHelper"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Home Page + + + + <% + + user user = WebHelper.authenticate(request.getCookies(), session); + + if (user == null) { + String username = request.getParameter("username"); + String password = request.getParameter("password"); + + + if (username != null && password != null) { + + user = WebHelper.authenticate(username, password); + if (user != null) { + String sessionId = UUID.randomUUID().toString().replace("-", "").toUpperCase(); + // Create cookie and attach it to response + Cookie cookie = new Cookie("SESID", sessionId); + response.addCookie(cookie); + // Create session attribute + session.setAttribute(sessionId, user); + out.print("Welcome " + user.getFirstname()+ " " + user.getLastname()); + } else { + WebHelper.redirectToLogin(response); + } + } else { + WebHelper.redirectToLogin(response); + } + } else { + out.print("Welcome " + user.getFirstname() + " " + user.getLastname()); + } + %> + + diff --git a/CL-BSCSD-21-13/web-project/src/main/webapp/img_avatar2.png b/CL-BSCSD-21-13/web-project/src/main/webapp/img_avatar2.png new file mode 100644 index 0000000..04ad35f Binary files /dev/null and b/CL-BSCSD-21-13/web-project/src/main/webapp/img_avatar2.png differ diff --git a/CL-BSCSD-21-13/web-project/src/main/webapp/index.jsp b/CL-BSCSD-21-13/web-project/src/main/webapp/index.jsp new file mode 100644 index 0000000..0665025 --- /dev/null +++ b/CL-BSCSD-21-13/web-project/src/main/webapp/index.jsp @@ -0,0 +1,84 @@ +<%-- + Document : index + Created on : Dec 20, 2020, 10:09:16 AM + Author : Mohamed Ali +--%> +<%@page import="com.mycompany.web.project.Student"%> +<%@page import="com.mycompany.web.project.WebHelper"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + + + + + + index Page + + + <% + + out.print("

" + WebHelper.getgreeting() + "

"); + out.print("
"); + + Student[] students = WebHelper.getStudent(); + + out.print("
    "); + for(Student st : students) { + out.print("
  • " + st.getName() + "
  • "); + } + out.print("
"); + out.print("
"); + + out.print(""); + out.print(""); + + for(Student st : students){ + out.print(""); + out.print(""); + out.print(""); + out.print(""); + out.print(""); + } + out.print("
Student IDNameNIC
" + st.getId()+ "" + st.getName()+ "" + st.getNic()+ "
"); + + out.print("
"); + + out.print(""); + out.print(""); + + out.print(""); + for(Student st : students) { + out.print(""); + out.print(""); + out.print(""); + out.print(""); + out.print(""); + } + out.print(""); + out.print("
Student IDNameNIC
" + st.getId() +"" + st.getName()+"" + st.getNic()+"
"); + %> + +