Introduction
This article explains how to create an Admin page in Java. The Netbeans IDE is used for the sample example.
What is An Admin
An Admin is simply a user that has some extra authority/power from a normal user. When we talk in terms of a website, they have the power to manage other users, provide access to them, etcetera. About Admins, we say it is like an owner or a head of a website.
What's the Admin role
In terms of a website, an Admin creates the website architecture, its design, certain additive features in a website, etcetera. For example, when we create an "Online Website" like "online shopping", "online e-ticketing", "online examination", etcetera then an Admin has the power to control the entire website.
How to create an Admin in Java
For creating an Admin we have many ways, in this article I create an Admin user through a database table.
To create an Admin user, we need a table in a database that identifies that login user as an Admin. By determining thier role we can forward it to other pages.
Let's start creating an Admin
For creating an Admin we need to follow a specified procedure in Java.
Step 1
First create a database file named "reg"; the syntax is as in the following:
reg.sql
CREATE TABLE "REG" ( "UNAME" VARCHAR2(20) NOT NULL ENABLE, "UPASS" VARCHAR2(20) NOT NULL ENABLE, "UTYPE" VARCHAR2(20) NOT NULL ENABLE);
Step 2
Now we insert the following data:
Step 3
Open the NetBeans IDE.

Step 4
Choose "Java web" -> "web application" as in the following:

Step 5
Provide the name "AdminDemo" for your project as in the following.

Step 6
Choose the Java version and the server wizard as in the following.

Step 7
Now delete the default "index.jsp" file and create a new "index.html" file and provide the following code for it.
index.html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
</head><center>
<form action="checklogin.jsp">
<body bgcolor="khaki">
<h1>Welcome User</h1>
<table>
<tr>
<td>
UserName:
</td>
<td>
<input type="text" name="uname">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="upass">
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit">
</td>
<td>
<input type="reset" value="Reset">
</td>
</tr>
</table>
</body>
</html>
Step 8
Now create a JSP file with the name "checklogin" and the following code.
checklogin.jsp
<%@ page language="java" import="java.sql.*"%><b><center>
<%









Join the conversation! Your thoughts help the community grow.