Commit aeb709d0 authored by Fabian Dewantara Santonie's avatar Fabian Dewantara Santonie 🕊

Initial commit

parents
Pipeline #6560 failed with stages
in 7 seconds
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="C:/Users/admin/Desktop/TRAINING/mysql-connector-java-8.0.28.jar">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tugasAkhir_Fabian</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="tugasAkhir_Fabian">
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="context-root" value="tugasAkhir_Fabian"/>
<property name="java-output-path" value="/tugasAkhir_Fabian/build/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="java"/>
<fixed facet="jst.web"/>
<installed facet="java" version="17"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Window
\ No newline at end of file
package org.tugasAkhir.servlet;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DatabaseConnection {
protected static Connection initializeDatabase()
throws SQLException, ClassNotFoundException
{
String dbDriver = "com.mysql.jdbc.Driver";
String dbURL = "jdbc:mysql://localhost/";
String dbName = "belajar";
String dbUsername = "root";
String dbPassword = "Fab123";
Class.forName(dbDriver);
Connection con = DriverManager.getConnection(dbURL+dbName+"?autoReconnect=true&useSSL=false", dbUsername, dbPassword);
return con;
}
}
package org.tugasAkhir.servlet;
import java.sql.Date;
public class Mahasiswa {
private Integer id;
private String nama;
private String nama_panggilan;
private String tempat_lahir;
private Date tanggal_lahir;
private String jenis_kelamin;
private String hobi;
private String email;
private Integer anak_ke;
private String pendidikan_terakhir;
private String alamat;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNama() {
return nama;
}
public void setNama(String nama) {
this.nama = nama;
}
public String getNama_panggilan() {
return nama_panggilan;
}
public void setNama_panggilan(String nama_panggilan) {
this.nama_panggilan = nama_panggilan;
}
public String getTempat_lahir() {
return tempat_lahir;
}
public void setTempat_lahir(String tempat_lahir) {
this.tempat_lahir = tempat_lahir;
}
public Date getTanggal_lahir() {
return tanggal_lahir;
}
public void setTanggal_lahir(Date tanggal_lahir) {
this.tanggal_lahir = tanggal_lahir;
}
public String getJenis_kelamin() {
return jenis_kelamin;
}
public void setJenis_kelamin(String jenis_kelamin) {
this.jenis_kelamin = jenis_kelamin;
}
public String getHobi() {
return hobi;
}
public void setHobi(String hobi) {
this.hobi = hobi;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getAnak_ke() {
return anak_ke;
}
public void setAnak_ke(Integer anak_ke) {
this.anak_ke = anak_ke;
}
public String getPendidikan_terakhir() {
return pendidikan_terakhir;
}
public void setPendidikan_terakhir(String pendidikan_terakhir) {
this.pendidikan_terakhir = pendidikan_terakhir;
}
public String getAlamat() {
return alamat;
}
public void setAlamat(String alamat) {
this.alamat = alamat;
}
}
package org.tugasAkhir.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.tugasAkhir.servlet.DatabaseConnection;
/**
* Servlet implementation class deleteData
*/
@WebServlet("/deleteData")
public class deleteData extends HttpServlet {
private static final long serialVersionUID = 1L;
public deleteData() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try {
Connection con = DatabaseConnection.initializeDatabase();
PreparedStatement st = con.prepareStatement("delete from tbl_mahasiswa where id=?");
st.setString(1, request.getParameter("id"));
st.executeUpdate();
st.close();
con.close();
response.sendRedirect(request.getContextPath()+"/menuAwal");
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
}
}
package org.tugasAkhir.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.tugasAkhir.servlet.Mahasiswa;
@WebServlet("/editData")
public class editData extends HttpServlet {
private static final long serialVersionUID = 1L;
public editData() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try {
Connection con = DatabaseConnection.initializeDatabase();
Statement stmt = (Statement) con.createStatement();
ResultSet rs = stmt.executeQuery("select * from tbl_mahasiswa where id = "+Integer.valueOf(request.getParameter("id")));
rs.next();
request.setAttribute("id", rs.getInt("id"));
request.setAttribute("nama", rs.getString("nama"));
request.setAttribute("nama_panggilan", rs.getString("nama_panggilan"));
request.setAttribute("tempat_lahir", rs.getString("tempat_lahir"));
request.setAttribute("tanggal_lahir", rs.getDate("tanggal_lahir"));
request.setAttribute("jenis_kelamin", rs.getString("jenis_kelamin"));
request.setAttribute("hobi", rs.getString("hobi"));
request.setAttribute("email", rs.getString("email"));
request.setAttribute("anak_ke", rs.getInt("anak_ke"));
request.setAttribute("pendidikan_terakhir", rs.getString("pendidikan_terakhir"));
request.setAttribute("alamat", rs.getString("alamat"));
request.getRequestDispatcher("editData.jsp").forward(request, response);
}
catch(Exception e) {
e.printStackTrace();
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Connection con = DatabaseConnection.initializeDatabase();
PreparedStatement st = con.prepareStatement("update tbl_mahasiswa set nama = ?, nama_panggilan = ?, tempat_lahir = ?, tanggal_lahir = ?, jenis_kelamin = ?, hobi = ?, email = ?, anak_ke = ?, pendidikan_terakhir = ?, alamat = ? where id = ?");
st.setString(1, request.getParameter("nama"));
st.setString(2, request.getParameter("nama_panggilan"));
st.setString(3, request.getParameter("tempat_lahir"));
st.setString(4, request.getParameter("tanggal_lahir"));
st.setString(5, request.getParameter("jenis_kelamin"));
st.setString(6, request.getParameter("hobi"));
st.setString(7, request.getParameter("email"));
st.setString(8, request.getParameter("anak_ke"));
st.setString(9, request.getParameter("pendidikan_terakhir"));
st.setString(10, request.getParameter("alamat"));
st.setString(11, request.getParameter("id"));
st.executeUpdate();
st.close();
con.close();
response.sendRedirect(request.getContextPath()+"/menuAwal");
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
}
}
package org.tugasAkhir.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@WebServlet("/halamanLogin")
public class halamanLogin extends HttpServlet {
private static final long serialVersionUID = 1L;
public halamanLogin() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String email = request.getParameter("email");
String password = request.getParameter("password");
out.println("<html>");
out.println("<head>");
out.println("<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Audiowide\">");
out.println("<style>");
out.println("body { font-family: \"Audiowide\", sans-serif;}");
out.println("</style>");
out.println("<title>Servlet Greetings</title>");
out.println("</head>");
out.println("<body>");
if(email.equalsIgnoreCase("fabian") && password.equals("fabian")) {
HttpSession session = request.getSession();
session.setAttribute("email", email);
//request.getRequestDispatcher("view.jsp").forward(request, response);
//request.getRequestDispatcher("Test2.jsp").forward(request, response);
response.sendRedirect(request.getContextPath() + "/menuAwal");
}
else {
out.println("Username/Password Salah");
out.println("<br>");
out.println("<a href=\"Login.jsp\">Kembali Login</a>");
}
out.println("</body>");
out.println("</html>");
}
}
package org.tugasAkhir.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class inputData
*/
@WebServlet("/inputData")
public class inputData extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public inputData() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Connection con = DatabaseConnection.initializeDatabase();
PreparedStatement st = con.prepareStatement("insert into tbl_mahasiswa values(?,?,?,?,?,?,?,?,?,?,?)");
String hobiBerenang = request.getParameter("hobiBerenang");
String hobiFutsal = request.getParameter("hobiFutsal");
String hobiBuku = request.getParameter("hobiBuku");
String hobiBadminton = request.getParameter("hobiBadminton");
String hobiLainnya = request.getParameter("hobiLainnya");
String hobi = "";
try {
if (hobiBerenang.equals("Berenang")) {
hobi = hobi + hobiBerenang +" ";
}
}
catch (Exception e) {
}
try {
if (hobiBuku.equals("Membaca_Buku")) {
hobi = hobi + hobiBuku +" ";
}
}
catch (Exception e) {
}
try {
if (hobiFutsal.equals("Futsal")) {
hobi = hobi + hobiFutsal +" ";
}
}
catch (Exception e) {
}
try {
if (hobiBadminton.equals("Badminton")) {
hobi = hobi + hobiBadminton +" ";
}
}
catch (Exception e) {
}
try {
if (hobiLainnya.equals("Lainnya")) {
hobi = hobi + hobiLainnya +" ";
}
}
catch (Exception e) {
}
st.setString(1, request.getParameter("id"));
st.setString(2, request.getParameter("nama"));
st.setString(3, request.getParameter("nama_panggilan"));
st.setString(4, request.getParameter("tempat_lahir"));
st.setString(5, request.getParameter("tanggal_lahir"));
st.setString(6, request.getParameter("jenis_kelamin"));
st.setString(7, request.getParameter("hobi"));
st.setString(8, request.getParameter("email"));
st.setString(9, request.getParameter("anak_ke"));
st.setString(10, request.getParameter("pendidikan_terakhir"));
st.setString(11, request.getParameter("alamat"));
st.executeUpdate();
st.close();
con.close();
response.sendRedirect(request.getContextPath()+"/menuAwal");
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
}
}
package org.tugasAkhir.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.tugasAkhir.servlet.Mahasiswa;
import org.tugasAkhir.servlet.DatabaseConnection;
/**
* Servlet implementation class menuAwal
*/
@WebServlet("/menuAwal")
public class menuAwal extends HttpServlet {
private static final long serialVersionUID = 1L;
public menuAwal() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Connection con = DatabaseConnection.initializeDatabase();
Statement stmt = null;
stmt = (Statement) con.createStatement();
String query = "select * from tbl_mahasiswa";
ResultSet rs = stmt.executeQuery(query);
List<Mahasiswa> mahasiswaList = new ArrayList<Mahasiswa>();
while (rs.next()) {
Mahasiswa mahasiswa = new Mahasiswa();
mahasiswa.setId(rs.getInt("id"));
mahasiswa.setNama(rs.getString("nama"));
mahasiswa.setNama_panggilan(rs.getString("nama_panggilan"));
mahasiswa.setTempat_lahir(rs.getString("tempat_lahir"));
mahasiswa.setTanggal_lahir(rs.getDate("tanggal_lahir"));
mahasiswa.setJenis_kelamin(rs.getString("jenis_kelamin"));
mahasiswa.setHobi(rs.getString("hobi"));
mahasiswa.setEmail(rs.getString("email"));
mahasiswa.setAnak_ke(rs.getInt("anak_ke"));
mahasiswa.setPendidikan_terakhir(rs.getString("pendidikan_terakhir"));
mahasiswa.setAlamat(rs.getString("alamat"));
mahasiswaList.add(mahasiswa);
}
request.setAttribute("mahasiswaList", mahasiswaList);
request.getRequestDispatcher("view.jsp").forward(request, response);
}
catch(SQLException | ClassNotFoundException e) {
}
}
}
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<h1>Menu Login</h1>
<h6>Silakan Masukan Username dan Password Anda</h6>
<form name="loginForm" method="post" action="halamanLogin">
<table class="table-sm" style="with: 80%">
<tr>
<td>Email</td>
<td><input type="text" name="email" id="email" required placeholder="Masukan Email..."></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" id="kode" required placeholder="Masukan Password..."></td>
</tr>
</table>
<input type="submit" name="submit">
</form>
</div>
</form>
</body>
</html>
\ No newline at end of file
Manifest-Version: 1.0
Class-Path:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<h1>Edit Data</h1>
<h6>ID Pengguna Tidak Dapat Diubah</h6>
<form name="loginForm" method="post" action="editData">
<table class="table-sm">
<tr>
<td>ID</td>
<td><input type="text" class="form-control" id="id" name="id" maxlength="100" readonly value = ${id}></td>
<tr>
<td>Nama Lengkap</td>
<td><input type="text" class="form-control" id="nama" name="nama" maxlength="100" required value= ${nama}></td>
</tr>
<tr>
<td>Nama Panggilan</td>
<td><input type="text" class="form-control" id="nama_panggilan" name="nama_panggilan" maxlength="10" required value= ${nama_panggilan}></td>
</tr>
<tr>
<td>Tempat Lahir</td>
<td><input type="text" class="form-control" id="tempat_lahir" name="tempat_lahir" required value = ${tempat_lahir}></td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td><input type="date" id="tanggal_lahir" name="tanggal_lahir" min="1900-01-01" max="2020-01-01" value = ${tanggal_lahir}></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td><select id="jenis_kelamin" name="jenis_kelamin"> <option value= ${jenis_kelamin}> ${jenis_kelamin} </option>
<option value="Laki-Laki">Laki-Laki</option> <option value="Perempuan">Perempuan</option> </select> </td>
</tr>
<tr>
<td>Hobi</td>
<td>
<input type="checkbox" id="hobiBerenang" name="hobiBerenang" value="Berenang"><label for="hobiBerenang">Berenang</label>
<input type="checkbox" id="hobiBuku" name="hobiBuku" value="Membaca_Buku"><label for="hobiBuku">MembacaBuku</label>
<input type="checkbox" id="hobiFutsal" name="hobiFutsal" value="Futsal"><label for="hobiFutsal">Futsal</label>
<input type="checkbox" id="hobiBadminton" name="hobiBadminton" value="Badminton"><label for="hobiBadminton">Badminton</label>
<input type="checkbox" id="hobiLainnya" name="hobiLainnya" value="Lainnya"><label for="hobiLainnya">Lainnya</label>
</td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type="email" class="form-control" id="email" name="email" required value = ${email}></td>
</tr>
<tr>
<td>Anak Ke</td>
<td><input type="number" class="form-control" id="anak_ke" name="anak_ke" min="1" max="15" required value = ${anak_ke}></td>
</tr>
<tr>
<td>Pendidikan</td>
<td>
<input type="radio" id="lulusanSD" name="pendidikan_terakhir" value = "SD"><label for="lulusanSD">SD</label>
<input type="radio" id="lulusanSMP" name="pendidikan_terakhir" value="SMP"><label for="lulusanSMP">SMP</label>
<input type="radio" id="lulusanSMA" name="pendidikan_terakhir" value="SMA"><label for="lulusanSMA">SMA</label>
<input type="radio" id="lulusanS1" name="pendidikan_terakhir" value="Strata 1"><label for="lulusanS1">Strata 1</label>
<input type="radio" id="lulusanS2" name="pendidikan_terakhir" value="Strata 2"><label for="lulusanS2">Strata 2</label>
<input type="radio" id="lulusanS3" name="pendidikan_terakhir" value="Strata 3"><label for="lulusanS3">Strata 3</label>
</td>
</tr>
<tr>
<td>Alamat</td>
<td><textarea class="form-control" id="alamat" name="alamat" required value = ${alamat}>${alamat}</textarea></td>
</tr>
</table>
<input type="submit" class="btn btn-light" value="Submit Data">
<input type="reset" class="btn btn-light" value="Reset">
</form>
</div>
</form>
</body>
</html>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<h1>Data Mahasiswa Baru</h1>
<h6>Masukan Data Diri Anda</h6>
<form name="loginForm" method="post" action="inputData">
<table class="table-sm">
<tr>
<td>ID</td>
<td><input type="text" class="form-control" id="id" name="id" maxlength="100" required placeholder="Masukan ID Mahasiswa..."></td>
<tr>
<td>Nama Lengkap</td>
<td><input type="text" class="form-control" id="nama" name="nama" maxlength="100" required placeholder="Masukan Nama Lengkap..."></td>
</tr>
<tr>
<td>Nama Panggilan</td>
<td><input type="text" class="form-control" id="nama_panggilan" name="nama_panggilan" maxlength="10" required placeholder="Masukan Nama Panggilan..."></td>
</tr>
<tr>
<td>Tempat Lahir</td>
<td><input type="text" class="form-control" id="tempat_lahir" name="tempat_lahir" required placeholder="Masukan Tempat Lahir..."></td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td><input type="date" id="tanggal_lahir" name="tanggal_lahir" min="1900-01-01" max="2020-01-01" value = "yyyy-mm-dd"></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td><select id="jenis_kelamin" name="jenis_kelamin"> <option value= "">--Masukan Jenis Kelamin--</option>
<option value="Laki-Laki">Laki-Laki</option> <option value="Perempuan">Perempuan</option> </select> </td>
</tr>
<tr>
<td>Hobi</td>
<td>
<input type="checkbox" id="hobiBerenang" name="hobiBerenang" value="Berenang"><label for="hobiBerenang">Berenang</label>
<input type="checkbox" id="hobiBuku" name="hobiBuku" value="Membaca_Buku"><label for="hobiBuku">MembacaBuku</label>
<input type="checkbox" id="hobiFutsal" name="hobiFutsal" value="Futsal"><label for="hobiFutsal">Futsal</label>
<input type="checkbox" id="hobiBadminton" name="hobiBadminton" value="Badminton"><label for="hobiBadminton">Badminton</label>
<input type="checkbox" id="hobiLainnya" name="hobiLainnya" value="Lainnya"><label for="hobiLainnya">Lainnya</label>
</td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type="email" class="form-control" id="email" name="email" required placeholder="Masukan Email..."></td>
</tr>
<tr>
<td>Anak Ke</td>
<td><input type="number" class="form-control" id="anak_ke" name="anak_ke" min="1" max="15" required placeholder="Anak Ke..."></td>
</tr>
<tr>
<td>Pendidikan</td>
<td>
<input type="radio" id="lulusanSD" name="pendidikan_terakhir" value = "SD"><label for="lulusanSD">SD</label>
<input type="radio" id="lulusanSMP" name="pendidikan_terakhir" value="SMP"><label for="lulusanSMP">SMP</label>
<input type="radio" id="lulusanSMA" name="pendidikan_terakhir" value="SMA"><label for="lulusanSMA">SMA</label>
<input type="radio" id="lulusanS1" name="pendidikan_terakhir" value="Strata 1"><label for="lulusanS1">Strata 1</label>
<input type="radio" id="lulusanS2" name="pendidikan_terakhir" value="Strata 2"><label for="lulusanS2">Strata 2</label>
<input type="radio" id="lulusanS3" name="pendidikan_terakhir" value="Strata 3"><label for="lulusanS3">Strata 3</label>
</td>
</tr>
<tr>
<td>Alamat</td>
<td><textarea class="form-control" id="alamat" name="alamat" required placeholder="Masukan Alamat..."></textarea></td>
</tr>
</table>
<input type="submit" class="btn btn-light" value="Submit Data">
<input type="reset" class="btn btn-light" value="Reset">
<br><br>
</form>
</div>
</form>
</body>
</html>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="org.tugasAkhir.servlet.Mahasiswa"%>
<!DOCTYPE html>
<html>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div align="right">
<a href="Login.jsp"><button class="btn btn-primary">Logout</button></a>
</div>
<div align="center">
<table class="table table-striped" border="2">
<tr>
<th>ID</th>
<th>Nama Mahasiswa</th>
<th>Nama Panggilan</th>
<th>Tempat Lahir</th>
<th>Tanggal Lahir</th>
<th>Jenis Kelamin</th>
<th>Hobi</th>
<th>E-Mail</th>
<th>Anak Ke</th>
<th>Pendidikan Terakhir</th>
<th>Alamat</th>
</tr>
<% List<Mahasiswa> mahasiswaList = (ArrayList<Mahasiswa>)request.getAttribute("mahasiswaList");
for(Mahasiswa mahasiswa: mahasiswaList)
{ %>
<tr>
<td><%=mahasiswa.getId()%></td>
<td><%=mahasiswa.getNama()%></td>
<td><%=mahasiswa.getNama_panggilan()%></td>
<td><%=mahasiswa.getTempat_lahir()%></td>
<td><%=mahasiswa.getTanggal_lahir()%></td>
<td><%=mahasiswa.getJenis_kelamin()%></td>
<td><%=mahasiswa.getHobi()%></td>
<td><%=mahasiswa.getEmail()%></td>
<td><%=mahasiswa.getAnak_ke()%></td>
<td><%=mahasiswa.getPendidikan_terakhir()%></td>
<td><%=mahasiswa.getAlamat()%></td>
<td><a href="editData?id=<%= mahasiswa.getId()%>"><button class="btn btn-info">Edit</button></a></td>
<td><a href="deleteData?id=<%= mahasiswa.getId()%>" onclick="return confirm('Apakah anda Yakin?');"><button class="btn btn-danger">Delete</button></a></td>
</tr>
<%}%>
</table>
<a href="mahasiswaBaru.jsp"><button class="btn btn-primary">Tambah Data</button></a>
</div>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment