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

Read the below instructions carefully before you start.

 Software Requirement: Apache NetBeans 13, MS SQL Server 2008 R2+ or higher, Java SE
Development Kit 8u321, Apache Tomcat 10.
 Download the given material then unzip.
 You receive folders: Q1_XXX (1) and Q2_XXX (2) … They are template for your corresponding
exam questions. Q1_XXX used for question number 1 and Q2_XXX for question number 2 and
so on. Open them as NetBeans project, replace XXX by [your student ID], e.g. Q1_SE1111,
Q2_SE1111, Q3_SE1111. Change the context application to new name, e.g.
/Q1_SE1111/Index.html instead of /Q1_XXX/Index.html. Your work will not be considered
for grading if this condition is not satisfied.
 Template project already contains the DBContext.java (3) to source package (src\java\dal)
under folder (2),(3).
 You MUST use DBContext.java for your database activities. Update your database connection
string by filling values for instance variables in the constructor.
 All allowed libraries (if needed, including jdbc 6.0 and jakarta jstl 2.0) are already added to your
given NetBeans projects, you are NOT allowed to change or add more libraries.
On completion, read submission guide carefully.
Note: In case you cannot submit the exam due to your submission folder contains more than 20MB. Open
Netbeans > right click on the project icon > Clean. It would help if you did it for all questions. Netbeans
will delete the .class files and reduce the size of your projects.
Question 1>
(2 points)
You are required to design the index.html page as below figure:

Figure 1: index.html page


There are some notes to design the index.html page:

 The [Financial Source] field can only be one of three options “Government”, “Grant” or “Self-
Sponsor”.
 Study [Level] field contains 3 options: “Bsc”, “Master” and “PhD”.
 [DOE] field is a date field
 Note that the text fields are left blank by default when the page is loaded. The user will fill in the
data in the Form.
 The users can access the index.html via /index.html

You gain (0.5 points) if you can provide the index.html page without any errors.
When the user clicks on the [Save] button. The data will be submitted to the EnrollServlet that can be
accessed by url pattern /enroll. The Servlet displays the submitted data to the user as following:

 You gain (0.5 points) if the index.html allows the user to submit data via POST method.
 If the Servlet is configured in the Standard Deployment Descriptor file (web.xml), you gain ( 0.5
points).
 If the Servlet can display correct submitted parameters, then you gain (0.5 points)
Question 2>
(3 points)
You are given a database script. Execute it to get the following database structure:

You are asked to develop a search page to allow users to search for students by name. The user can access
search page via /search (the URL of the page must be respected, otherwise student will receive a
ZERO for this question).

 The system displays search form as:

 Users fill the student’s name to text field, then click Search button.
o If the text field is blank, then the system displays all students.

o Otherwise, the system displays students who have name contained characters in the text
field as following:
The text field contains ‘in’.

The system displays students who have ‘in’ in their names.


Question 3>
(5 points)
You are given a database script. Execute it to get the following database structure:

You can understand that the system has stored a series of Threads (topics for discussion). Each user can
post Comments for each Thread. A Thread has many comments. Therefore, users will have to log in to
make comments.
Note: We have already imported data for the tables.
Your task is to build 2 web pages as described in the below table:

Page URL Description


Login Page /login Allow users to log into the system. User can use /login to access
the page
Discussion page /discuss Allow users to interact with the threads and comments. After
logging on to the system, user can use /discuss to access the page.

 The login page should display like the following (0.5 point):

 User fills in [Username] and [Password] and then clicks login. The system then checks the above
two information in the [Account] table. The system displays “Login successful!” if the Username
and Password are correct. Otherwise, the system displays “Login Failed.” (0.5 point).

 When the user accessed to the discussion page:


o The system displays “access denied” if the user did not login to the system.

o If user already logged in to the system, it displays threads and their comments as
following:
 If student can load all Threads, they will receive 1 point.
 If student can load comments corresponding to the threads, they will receive 1
point.
Note: Check the below descriptions for more detail.

 When the user filled to the text field corresponding to corresponding thread, then
clicks Save button, a new comment will be saved to database (Comment table).
(1 point)

You might also like