Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

IMPORTANT – before you start doing your solution, MUST do the following steps:

1. Create your MS SQL database named JobDB by running code in script


JobDB.sql.
2. Copy given file DBContext.java (2) to source package (src\java) folder under your web project. You
might need to use and name a java package for (2), free to set the name of package.
3. You MUST use DBContext.java for your all database connection.
4. Set the home page/default for your project as AddJob.jsp page.

Questions:

Create a AddJob.jsp page with GUI as below figures (0.5 Point):

Requirements:

- Value for Date Created is calculated automatically (cannot be changed), its current system date and
formatting of MM/dd/yyyy (0.5 Point).

When the users click on Save button, validate the data on the input form as rules:
- Require data for all text fields (0.5 Point - 0.25 Point for each error message).
When the validation is correct.

Add information on input form to Jobs table (1.5 Point) and browse to ListJobs.jsp page (0.25 Point).
When users click on the “All Job(s)” button, browse to ListJobs.jsp page (0.25 Point) which will be shown as
below.
The table must have the same columns with one in above figures.

Requirements:

- Output all Jobs in Jobs table to ListJobs.jsp as above table (1.5 Point).

- Calculate and display the number of jobs of result (0.25 Point).

- Values for Activated should be as Yes (for true or 1) or No (for false or 0) (0.25 Point).

When users click on hyperlink of “Job ID” or “Job Name”, browse to EmployeeJob.jsp which will output
information of all employees as check box list, check on a checkbox if the job of that employee is equals to
selected job (1.5 Point), otherwise disable checkbox (0.5 Point), also output number of checked checkboxs
( number of employees are availble for selected job) (0.5 Point).

When users click on Arrange Job, browse to ArrangeJob.jsp which will assign a selected job to an employee
(0.25 Point)
Requirements:

- Output selected job to ArrangeJob.jsp (0.5 Point).

- Output all employees to the dropdown list, display employee name (0.5 Point).

When the users select an employee from dropdown list and click on the Assgin button, save information on
input form to JobEmployee (0.5 Point) table and browse to EmployeeJob.jsp page (0.25 point).

Given JobDB.sql

create database JobDB


go
USE [JobDB]
GO
CREATE TABLE [Jobs](
[ID] [smallint] IDENTITY(1,1) NOT NULL primary key,
[Name] [varchar](50) NOT NULL,
[Salary] money not null,
[Datecreated] date not null,
[Activated] bit not null,
)
GO
INSERT [dbo].[Jobs] ([name],[salary],[datecreated],[activated]) VALUES
(N'Designer',7000,'1/21/2015',1)
INSERT [dbo].[Jobs] ( [name],[salary],[datecreated],[activated]) VALUES
(N'Managing Editor',1000,'11/3/1990',0)
INSERT [dbo].[Jobs] ( [name],[salary],[datecreated],[activated]) VALUES
(N'Marketing Manager',5000,'9/19/1996',0)
INSERT [dbo].[Jobs] ( [name],[salary],[datecreated],[activated]) VALUES (N'Public
Relations Manager',2000,'12/7/2014',1)
GO
CREATE TABLE [Employee](
[ID] [char](9) NOT NULL primary key,
[FullName] [varchar](51) NOT NULL,
[HireDate] [datetime] NOT NULL,
[City] nvarchar(150) not null
)
GO
INSERT [dbo].[Employee] ([id], [FullName], [HireDate],[City]) VALUES (N'EMP01',
N'Paolo Accorti', CAST(0x0000843100000000 AS DateTime),'London')
INSERT [dbo].[Employee] ([id], [FullName], [HireDate],[City]) VALUES (N'EMP02',
N'Pedro Afonso', CAST(0x000081CD00000000 AS DateTime),'Paris')
INSERT [dbo].[Employee] ([id], [FullName], [HireDate],[City]) VALUES (N'EMP03',
N'Victoria Ashworth', CAST(0x0000816700000000 AS DateTime),'Moscow')
INSERT [dbo].[Employee] ([id], [FullName], [HireDate],[City]) VALUES (N'EMP04',
N'Helen Bennett', CAST(0x0000800200000000 AS DateTime),'Moscow')
INSERT [dbo].[Employee] ([id], [FullName], [HireDate],[City]) VALUES (N'EMP05',
N'Lesley Brown', CAST(0x0000820000000000 AS DateTime),'Rostov')
GO
create table JobEmployee
(
ID int identity (1,1) primary key,
Empid char(9) references Employee(ID),
Jobid smallint references Jobs(ID)
)
Go
insert into JobEmployee(Empid,Jobid) values('EMP01',1)
insert into JobEmployee(Empid,Jobid) values('EMP01',2)
insert into JobEmployee(Empid,Jobid) values('EMP02',2)
insert into JobEmployee(Empid,Jobid) values('EMP03',4)

You might also like