You are on page 1of 7

Core Java Case Study

Core Java Case Study

Core Java Case Study

00

Contents

CASE STUDY ACTIVITY - COLLECTIONS

CASE STUDY ACTIVITY - JDBC

CASE STUDY ACTIVITY SERVLETS AND JSP (DAY 10)

CASE STUDY ACTIVITY SERVLETS AND JSP (DAY 11)

CASE STUDY ACTIVITY SERVLETS AND JSP (DAY 12)

Core Java Case Study

01

Case Study Activity - Collections

Case Study
Number
Requirement/Task

CS1
1) Create a Student class consisting of the following attributes and
appropriate getter setter methods to access those attributes
a) Id (String)
b) name(String)
c) subject(String)
d) score(int)
2) Make Sure Student class implements java.io.Serializable interface.
3) Write a program to create 3 Student objects and store it in an ArrayList
structure.
4) Write a method to traverse the ArrayList created in step 3 and print the
contents of that array list.

Time

30 min.

S/W Required

Eclipse/RAD, JDK 1.7.

Core Java Case Study


02

Case Study Activity - JDBC

Case Study
Number
Requirement/Task

CS2
1) Create following two tables in the given database(DB2/DERBY)
a) STUDENT_DETAIL (STUDENT_ID VARCHAR(6), NAME VARCHAR(30),
SUBJECT VARCHAR(30), SCORE INTEGER) - PK(STUDENT_ID).
b) USER_DETAIL (USER_ID VARCHAR(6),PASSWD VARCHAR(8))
PK(USER_ID).
c) Insert some records in the above tables.
2)

Write two DAO Classes StudentDAO, UserDAO to access information


from the tables created in step 1.

3) Implement a public getStudents() inside StudentDAO which will return


a list of Student objects present in the STUDENT_DETAIL.
4) Implement a public checkValidUser(String user,String pwd) inside
UserDAO which will check the given values of user,pwd against the
values present in table USER_DETAIL and return a true/false value
accordingly.
Hint Reuse Classes created in Case Study CS1.

Time

60 minutes

S/W Required

Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars.

Core Java Case Study

03

Case Study Activity Servlets and JSP (Day 10)

Case Study
Number
Requirement/Task

CS3
1) Create a DB Enabled Web Application comprising of a single servlet.
2) Setup a JNDI Data Source pointing to the database created earlier in
Case Study CS2 & CS1.
3) Implement the servlet in a way such that it can fetch the list of students
from the table (using JNDI Data connection) and print it in the browser
in a tabular format when the application url(application context specific
servlet url) is invoked with a HTTP GET request.

Hints Reuse Classes/Tables created in Case Studies CS1,CS2.

Time

60 minutes

S/W Required

Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars, Tomcat/WAS server.

Core Java Case Study

04

Case Study Activity Servlets and JSP (Day 11)

Case Study
Number
Requirement/Task

CS4
1) Create a DB Enabled Web Application comprising of a single JSP login
page and one servlet.
2) User needs to provide the login credentials (userid, password) in the
login page and hit submit for the validation.
3) On receiving the request the servlet page will invoke a UserDAO class to
validate the given credentials.
4) Successful validation will show a greeting message to the user, otherwise
it will show one Invalid User/Password message and ask the user to
enter the credentials again.
Hints Reuse the DAO Classes, JNDI configuration, DB setup as created
in earlier case studies.

Time

60 minutes

S/W Required

Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars, Tomcat/WAS server.

Core Java Case Study

05

Case Study Activity Servlets and JSP (Day 12)

Case Study
Number
Requirement/Task

CS5
1) Create a DB Enabled Web Application comprising of three JSP pages and
one controller servlet
a) Login.jsp.
b) Welcome.jsp
c) StudentDetails.jsp (Use JSTL tags accordingly)
d) MainServlet.
2) The application will accept the login credentials from the user and on
success it will redirect the response to a welcome page containing one
greeting message and one link to the StudentDetails page.
3) Clicking on the StudentDetails link will fetch all the student records from
the STUDENT_DETAILS table and print the list in the browser.
Hints
i)
Use the MainServlet as the controller class which will accept
HTTP requests from the JSP page and redirect the response
accordingly.
ii)
ReUse StudentDAO & UserDAO from Case Study CS1.
iii)
Reuse the DB & Server configuration from CS2 & CS3.

Time

60 minutes

S/W Required

Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars, Tomcat/WAS server.

You might also like