Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
belajarJavaServlet_Fabian
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fabian Dewantara Santonie
belajarJavaServlet_Fabian
Commits
f8fc182d
Commit
f8fc182d
authored
Mar 22, 2022
by
Fabian Dewantara Santonie
🕊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Menambahkan Latihan 4
parent
07e019aa
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
275 additions
and
1 deletion
+275
-1
DataDiri.java
src/main/java/org/testing/inputName/DataDiri.java
+63
-0
Latihan4.java
src/main/java/org/testing/inputName/Latihan4.java
+73
-0
Latihan3.jsp
src/main/webapp/Latihan3.jsp
+0
-1
Latihan4.jsp
src/main/webapp/Latihan4.jsp
+28
-0
Registrasi.jsp
src/main/webapp/Registrasi.jsp
+75
-0
detailDataDiri.jsp
src/main/webapp/detailDataDiri.jsp
+36
-0
No files found.
src/main/java/org/testing/inputName/DataDiri.java
0 → 100644
View file @
f8fc182d
package
org
.
testing
.
inputName
;
import
java.io.IOException
;
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 DataDiri
*/
@WebServlet
(
"/DataDiri"
)
public
class
DataDiri
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* @see HttpServlet#HttpServlet()
*/
public
DataDiri
()
{
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
{
// TODO Auto-generated method stub
String
namaLengkap
=
request
.
getParameter
(
"namaLengkap"
);
String
namaPanggilan
=
request
.
getParameter
(
"namaPanggilan"
);
String
tempatLahir
=
request
.
getParameter
(
"tempatLahir"
);
String
tanggalLahir
=
request
.
getParameter
(
"tanggalLahir"
);
String
jenisKelamin
=
request
.
getParameter
(
"jenisKelamin"
);
String
hobi
=
request
.
getParameter
(
"hobi"
);
String
email
=
request
.
getParameter
(
"email"
);
String
anak
=
request
.
getParameter
(
"anak"
);
String
pendidikan
=
request
.
getParameter
(
"pendidikan"
);
String
alamat
=
request
.
getParameter
(
"alamat"
);
request
.
setAttribute
(
"namaLengkap"
,
namaLengkap
);
request
.
setAttribute
(
"namaPanggilan"
,
namaPanggilan
);
request
.
setAttribute
(
"tempatLahir"
,
tempatLahir
);
request
.
setAttribute
(
"tanggalLahir"
,
tanggalLahir
);
request
.
setAttribute
(
"jenisKelamin"
,
jenisKelamin
);
request
.
setAttribute
(
"hobi"
,
hobi
);
request
.
setAttribute
(
"email"
,
email
);
request
.
setAttribute
(
"anak"
,
anak
);
request
.
setAttribute
(
"pendidikan"
,
pendidikan
);
request
.
setAttribute
(
"alamat"
,
alamat
);
request
.
getRequestDispatcher
(
"detailDataDiri.jsp"
).
forward
(
request
,
response
);
}
}
\ No newline at end of file
src/main/java/org/testing/inputName/Latihan4.java
0 → 100644
View file @
f8fc182d
package
org
.
testing
.
inputName
;
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
;
/**
* Servlet implementation class Latihan4
*/
@WebServlet
(
"/Latihan4"
)
public
class
Latihan4
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* @see HttpServlet#HttpServlet()
*/
public
Latihan4
()
{
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
{
// TODO Auto-generated method stub
response
.
setContentType
(
"text/html;charset=UTF-8"
);
PrintWriter
out
=
response
.
getWriter
();
String
username
=
request
.
getParameter
(
"username"
);
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
(
username
!=
null
&&
username
.
equalsIgnoreCase
(
"fabian"
))
{
if
(
password
!=
null
&&
password
.
equals
(
"fabian"
))
{
response
.
sendRedirect
(
request
.
getContextPath
()+
"/Registrasi.jsp"
);
}
else
{
out
.
println
(
"Password Salah!"
);
out
.
println
(
"<a href=\"Latihan4.jsp\">Kembali Login</a>"
);
}
}
else
{
out
.
println
(
"Username Salah!"
);
out
.
println
(
"<a href=\"Latihan4.jsp\">Kembali Login</a>"
);
}
out
.
println
(
"</body>"
);
out
.
println
(
"</html>"
);
}
}
src/main/webapp/Latihan3.jsp
View file @
f8fc182d
...
...
@@ -3,7 +3,6 @@
<!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>
...
...
src/main/webapp/Latihan4.jsp
0 → 100644
View file @
f8fc182d
<%@ 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>
Masukan Username dan Password
</h1>
<form
action=
"/belajarJavaServlet_Fabian/Latihan4"
method =
"POST"
>
<table
style=
"with: 80%"
>
<tr>
<td>
Username
</td>
<td><input
type=
"text"
id=
"username"
name=
"username"
placeholder=
"Username..."
></td>
</tr>
<tr>
<td>
Password
</td>
<td><input
type=
"password"
id=
"password"
name=
"password"
placeholder=
"Password..."
></td>
</tr>
</table>
<input
type=
"submit"
value=
"Login"
>
</form>
</div>
</body>
</html>
\ No newline at end of file
src/main/webapp/Registrasi.jsp
0 → 100644
View file @
f8fc182d
<%@ 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
style=
"background-color: aqua;"
>
<div
class=
"form-group"
align=
"center"
>
<h1>
Masukan Username dan Password
</h1>
<form
action=
"/belajarJavaServlet_Fabian/DataDiri"
method =
"POST"
>
<table
class=
"table"
>
<tr>
<td>
Nama Lengkap
</td>
<td><input
type=
"text"
class=
"form-control"
id=
"namaLengkap"
name=
"namaLengkap"
maxlength=
"100"
placeholder=
"Masukan Nama Lengkap..."
></td>
</tr>
<tr>
<td>
Nama Panggilan
</td>
<td><input
type=
"text"
class=
"form-control"
id=
"namaPanggilan"
name=
"namaPanggilan"
maxlength=
"10"
placeholder=
"Masukan Nama Panggilan..."
></td>
</tr>
<tr>
<td>
Tempat Lahir
</td>
<td><input
type=
"text"
class=
"form-control"
id=
"tempatLahir"
name=
"tempatLahir"
placeholder=
"Masukan Tempat Lahir..."
></td>
</tr>
<tr>
<td>
Tanggal Lahir
</td>
<td><input
type=
"date"
id=
"tanggalLahir"
name=
"tanggalLahir"
value=
"yyyy-mm-dd"
min=
"1900-01-01"
max=
"2020-01-01"
></td>
</tr>
<tr>
<td>
Jenis Kelamin
</td>
<td><select
id=
"jenisKelamin"
name=
"jenisKelamin"
>
<option
value=
""
>
--Pilih 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"
placeholder=
"Masukan Alamat Email..."
></td>
</tr>
<tr>
<td>
Anak Ke
</td>
<td><input
type=
"number"
class=
"form-control"
id=
"anak"
name=
"anak"
min=
"1"
max=
"15"
placeholder=
"Dibatasi 1-15..."
></td>
</tr>
<tr>
<td>
Pendidikan
</td>
<td>
<input
type=
"radio"
id=
"lulusanSD"
name=
"pendidikan"
value =
"Tamatan SD"
><label
for=
"lulusanSD"
>
SD
</label>
<input
type=
"radio"
id=
"lulusanSMP"
name=
"pendidikan"
value=
"Tamatan SMP"
><label
for=
"lulusanSMP"
>
SMP
</label>
<input
type=
"radio"
id=
"lulusanSMA"
name=
"pendidikan"
value=
"Tamatan SMA"
><label
for=
"lulusanSMA"
>
SMA
</label>
<input
type=
"radio"
id=
"lulusanS1"
name=
"pendidikan"
value=
"Strata 1"
><label
for=
"lulusanS1"
>
Strata 1
</label>
<input
type=
"radio"
id=
"lulusanS2"
name=
"pendidikan"
value=
"Strata 2"
><label
for=
"lulusanS2"
>
Strata 2
</label>
<input
type=
"radio"
id=
"lulusanS3"
name=
"pendidikan"
value=
"Strata 3"
><label
for=
"lulusanS3"
>
Strata 3
</label>
</td>
</tr>
<tr>
<td>
Alamat
</td>
<td><textarea
class=
"form-control"
id=
"alamat"
name=
"alamat"
placeholder=
"Masukan Alamat Anda..."
></textarea></td>
</tr>
</table>
<input
type=
"submit"
value=
"Submit Data"
>
</form>
</div>
</body>
</html>
\ No newline at end of file
src/main/webapp/detailDataDiri.jsp
0 → 100644
View file @
f8fc182d
<%@ page
language=
"java"
contentType=
"text/html; charset=ISO-8859-1"
pageEncoding=
"ISO-8859-1"
%>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"ISO-8859-1"
>
<title>
Insert title here
</title>
</head>
<body>
<table
border=
"2"
>
<tr>
<th>
Nama Lengkap
</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
</th>
<th>
Alamat
</th>
</tr>
<tr>
<th>
${namaLengkap}
</th>
<th>
${namaPanggilan}
</th>
<th>
${tempatLahir}
</th>
<th>
${tanggalLahir}
</th>
<th>
${jenisKelamin}
</th>
<th>
${Hobi}
</th>
<th>
${email}
</th>
<th>
${anak}
</th>
<th>
${pendidikan}
</th>
<th>
${alamat}
</th>
</tr>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment