0% found this document useful (0 votes)
50 views11 pages

JSP Prac Set01

The document provides instructions for a 2-hour practical examination. It states that students must: 1) Create a folder named with their roll number to save all files. 2) File and object names must exactly match what is required in the question paper. It then provides two sample questions - one to create a bean and display its properties, and another to connect to a database table and display its records. Suggested solutions are also provided.

Uploaded by

kimhoang
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views11 pages

JSP Prac Set01

The document provides instructions for a 2-hour practical examination. It states that students must: 1) Create a folder named with their roll number to save all files. 2) File and object names must exactly match what is required in the question paper. It then provides two sample questions - one to create a bean and display its properties, and another to connect to a database table and display its records. Suggested solutions are also provided.

Uploaded by

kimhoang
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 11

PRACTICAL EXAMINATION-2HOURS

Important to students
Read carefully the following instructions before doing your work on the examination.
Your work will NOT be accepted for evaluation UNLESS it conforms to all the instructions.
- Students must create a folder named <Roll-Number> in the specified location
(e.g. d:\Online) and save all necessary files in the same folder.
- File names and object names must exactly be the same as required in
the question paper, otherwise your work will be rejected by evaluation
procedure.

JSP Set 01 Q.P. Page 1


Question 1 [20]
Create a bean called UserInfoDetails, which has the following properties:
Name, Address, Hobby, Age, and FavoriteColor.
Next, create question1.HTML document which contains a form as shown in Figure 1.
Finally create question1.JSP, accept the required details from the form and then pass the same values
to the bean. Display the results as shown in Figure 2.

Figure 1

/online/question1.jsp

Figure 2

JSP Set 01 Q.P. Page 2


Suggested Solution for the question 1

Question1.html Question1.jsp UserInfoDetail


(form) s
(bean)

(output)

Website structure Contains UserInfoDetails.java


myBeans is a package that contains
bean.

copy

Question1.html

Tên các inputs:


Name
Address
Hobby
Age
Color

UserInfoDetails.java

JSP Set 01 Q.P. Page 3


Question1.jsp

JSP Set 01 Q.P. Page 4


Question 2 [20]
Create database with table(s), which is described as follow:
Database Name: Employee
Table Name: Personnel
Columns: EmployeeID varchar(10)
FirstName varchar(20)
LastName varchar(20)
Address varchar(30)
DateOfBirth Datetime
DateOfJoin Datetime
Grade varchar(3)

Your assignments is to:


Create question2.JSP, which will read the records stored in the Personnel table and display the results in
a tabular format.

Notes: + Data must be input into the table


('Emp001','Brendan','Crasto','23 Fifth Avenue','10/28/1965','1/1/2001','003')
('Emp002','Bala','Brown','10 Fourth Avenue','6/22/1962','1/1/2002','001')
('Emp003','Thompson','Rice','19 Fourth Avenue','8/20/1960','1/1/2003','001')

+ You have to create Database.SQL scripting file which contains the script to create table
(Account table) and the script to insert data records into the Account table. The Database.SQL file must
be saved in folder d:\online\ <roll-number>.

Suggested Solution for question 2

1- Open MS SQL Server Enterprise, create the database employee


2- Design the table Personnel with the structure as required.

JSP Set 01 Q.P. Page 5


3- Open the table Personnel, input three records as described in the requirement.

4- Make the scripting file.

5-Save the scripting file with the name is Database.sql as required.


6- Open the scripting file, append three INSERT statements for three records as required.
7- Save the scripting file.
8- Open Control Panel/Administrative Tools/(Data Source)ODBC
9- Setup a new System DSN that will point to the database employee with the name employee

JSP Set 01 Q.P. Page 6


JSP Set 01 Q.P. Page 7
JSP Set 01 Q.P. Page 8
JSP Set 01 Q.P. Page 9
10- Write the page Question2.jsp

In order to save time for coding, you should create only one jsp file.In this file, code for connecting with
the database and access it will be written.

JSP Set 01 Q.P. Page 10


load driver

create connection

get ResultSet

create a table and table columns

copy data of a record to a row of the table

Result :

JSP Set 01 Q.P. Page 11

You might also like