Commit 972021c6 authored by Dio Harvandy's avatar Dio Harvandy

Perbaikan Tampilan-tampilan

parent 1f5a8742
......@@ -34,7 +34,7 @@ public class Login extends HttpServlet {
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (request.getParameter("logout") != null) {
if (request.getParameter("logout") != null || session != null) {
session.invalidate();
response.sendRedirect(request.getContextPath());
}
......@@ -51,19 +51,20 @@ public class Login extends HttpServlet {
Statement stmt = (Statement) con.createStatement();
ResultSet rs =
stmt.executeQuery("select * from tbl_user where email = '"+
request.getParameter("email").toString()+"' and password = "+request.getParameter("password"));
rs.next();
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String emailRes = request.getParameter("email").toString();
String passwordRes = request.getParameter("password").toString();
if(passwordRes.equals(rs.getString("password")) && emailRes.equals(rs.getString("email"))) {
request.getParameter("email").toString()+"' and password = '"+request.getParameter("password")+"'");
if(rs.next()) {
// String emailRes = request.getParameter("email").toString();
// String passwordRes = request.getParameter("password").toString();
// if(passwordRes.equals(rs.getString("password")) && emailRes.equals(rs.getString("email"))) {
HttpSession session = request.getSession(true);
session.putValue("nama", rs.getString("nama"));
session.putValue("email", rs.getString("email"));
response.sendRedirect(request.getContextPath()+"/datamahasiswa");
}
else {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<hmtl>");
out.println("<head>");
out.println("<title>Login Gagal</title>");
......@@ -71,7 +72,7 @@ public class Login extends HttpServlet {
out.println("<body>");
out.println("<h1 style='text-align: center;'>Login Gagal</h1>");
out.println("<h3 style='text-align: center;'>Email atau Password Anda Salah</h3>");
out.println("<h3 style='text-align: center;'><a href='index.jsp'>Kembali</a></h3>");
out.println("<h3 style='text-align: center;'><a href='Index.jsp'>Kembali</a></h3>");
out.println("</body>");
out.println("</hmtl>");
}
......
......@@ -10,12 +10,11 @@
<title>Edit Data Mahasiswa</title>
</head>
<body>
<ul class="nav justify-content-end navbar-light bg-light">
<li class="nav-item">
<ul class="navbar navbar-expand-lg justify-content-end navbar-light bg-light">
<div class="nav-item ">
<a class="nav-link" onclick="return confirm('Logout?');" href="login?logout=1"><%= session.getAttribute("email") %> <i class="fa fa-sign-out" aria-hidden="true"></i></a>
</li>
</div>
</ul>
<p class="text-center"></p>
<div class="container">
<div class="card m-auto">
<div class="card-header">
......
......@@ -10,12 +10,11 @@
<title>Tambah Data Mahasiswa</title>
</head>
<body>
<ul class="nav justify-content-end navbar-light bg-light">
<li class="nav-item">
<ul class="navbar navbar-expand-lg justify-content-end navbar-light bg-light">
<div class="nav-item ">
<a class="nav-link" onclick="return confirm('Logout?');" href="login?logout=1"><%= session.getAttribute("email") %> <i class="fa fa-sign-out" aria-hidden="true"></i></a>
</li>
</div>
</ul>
<p class="text-center"></p>
<div class="container">
<div class="card m-auto">
<div class="card-header">
......
......@@ -15,19 +15,20 @@
<style type="text/css">
td{
border: 1px solid;
text-align: center;
}
</style>
<title>Data Mahasiswa</title>
</head>
<body>
<ul class="nav justify-content-end navbar-light bg-light">
<li class="nav-item">
<ul class="navbar navbar-expand-lg justify-content-end navbar-light bg-light">
<a href="datamahasiswa" class="navbar-brand text-muted">Data Mahasiswa</a>|
<div class="nav-item ">
<a class="nav-link" onclick="return confirm('Logout?');" href="login?logout=1"><%= session.getAttribute("email") %> <i class="fa fa-sign-out" aria-hidden="true"></i></a>
</li>
</div>
</ul>
<p class="text-center">${pesan}</p>
<a href="datamahasiswa" class="nav-link"><h4 class="text-muted text-center">Data Mahasiswa</h4></a>
<div class="table-responsive-xxl">
<table class="table table-sm table-striped table-hover" style="width: 95%; margin: auto;">
<thead>
......@@ -46,7 +47,7 @@
<th style="text-align: center;" scope="col" width="5px">Nama Panggilan</th>
<th style="text-align: center; width: 8%;" scope="col">Tempat Lahir</th>
<th style="text-align: center; width: 8%;" scope="col">Tanggal Lahir</th>
<th style="text-align: center;" scope="col" width="5px">Jenis Kelamin</th>
<th style="text-align: center;" scope="col">Jenis Kelamin</th>
<th style="text-align: center; width: 9%;" scope="col">Hobi</th>
<th style="text-align: center; width: 10%;" scope="col">Email</th>
<th style="text-align: center;" scope="col" width="5px">Anak Ke</th>
......@@ -58,9 +59,10 @@
<tbody>
<% List<Mahasiswa> mhsList = (ArrayList<Mahasiswa>)request.getAttribute("mhsList");
SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM yyyy",new Locale("id", "ID"));
int no = 1;
for (Mahasiswa mhs : mhsList){ String[] hobi = mhs.getHobi().split(";");%>
<tr>
<td scope="row"><%= mhs.getId() %></td>
<td scope="row"><%= no %></td>
<td><%= mhs.getNama() %></td>
<td><%= mhs.getNamaPanggilan() %></td>
<td><%= mhs.getTempatLahir() %></td>
......@@ -74,7 +76,7 @@
<td style="text-align: center;"><a href="editdatamahasiswa?id=<%= mhs.getId() %>" class="btn btn-sm btn-warning"><i class="fa fa-pencil" aria-hidden="true"></i></a>
<a href="deletedatamahasiswa?id=<%= mhs.getId() %>" class="btn btn-sm btn-danger" onclick="return confirm('Delete This Item?');"><i class="fa fa-trash" aria-hidden="true"></i></a></td>
</tr>
<%}%>
<%no++;}%>
</tbody>
</table>
</div>
......
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