Core Java Case Study
Core Java Case Study
1
Core Java Case Study
3
4
5
6
7
2
Core Java Case Study
Case Study Number Requirement/Task
3
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
Case Study Number Requirement/Task
CS2
1) Create following two tables in the g iven 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) 2)
Insert some records in the above tables.
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 tr ue/false value accordingly. Hint – Reuse Classes created in Case Study CS1.
4
Time
60 minutes
S/W Required
Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars.
Core Java Case Study
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 re quest.
Hints – Reuse Classes/Tables created in Case Studies CS1,CS2.
5
Time
60 minutes
S/W Required
Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars, Tomcat/WAS server.
Core Java Case Study
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 c lass 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.
6
Time
60 minutes
S/W Required
Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars, Tomcat/WAS server.
Core Java Case Study
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 t he StudentDetails page. 3) Clicking on the StudentDetails link will fetch all the student r ecords 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.
7
Time
60 minutes
S/W Required
Eclipse/RAD, JDK 1.7, DB2 or Derby, Appropriate DB jars, Tomcat/WAS server.