JT Practical List 2019-20
JT Practical List 2019-20
IV
Java Technology
Practical List
Last updated on 12/03/2020
2. Write a Java application to create table, to store and fetch student registration information
(like firstName, lastName, branch, username and password) from database using JDBC.
(Using Statement object)
2 Working with JDBC and Servlets 2
1. Write a Java application to fetch records of student registration and practice the use of
the following methods of ResultSet interface: absolute(), afterLast(), beforeFirst(),
first(), isFirst(), isLast(), last(), previous(), next(),relative()
2. Write a servlet that displays a hello message on thebrowser. Understanding java Servlet
life cycle. Use deployment descriptor file.
3 Working with Servlets 2
1. Write a Java web application for a login module which contains the following
components:
index.html : for getting input from theuser.
ValidateServlet.java : a servlet class for validating the user. If it is a valid user
(validate from database using PreparedStatement), it will forward the request to
the welcome servlet. If user is not validated then it displays Error message
along with the response fromindex.html.
WelcomeServlet.java : a servlet class for displaying the welcomemessage.
1.
2. Write a Java web application to search a word or phrase on Google search engine. The
application should have followingcomponents:
Search.html: It contains a textbox to accept search word or phrase fromuser.
SearchOnGoogleServlet.java: It should redirect the search query to Google
search engine.
3. Write a Java web application to demonstrate usage of JSP Scripting Elements (Scriptlet,
Expression, Declaration) and JSP implicit objects (out, request, response.)
Use method post to submit a feedback form (html) (Full Name, Email, Subject,
Message)to a jsp page and let jsp page preview the same as confirmation page
with additional text “Feedback received. Thank you.”.
5 Working with Servlets and JSP 2
1. Write a web based Java application which allows the user to download a file from the
list of available files. The application has two components as follow:
FileList.html: It displays a list of files to the user to choose a file to download.
FileDownloadServlet: It takes the user’s choice for a file to be downloaded and
sends that file in response to the user.
2. Given a design goal below, write a web based application using the following standard
actions: jsp:useBean (with attributes:‘id’, ‘scope’, ‘type’, and ‘class’), jsp:getProperty
to display final results.
3. Components identified as follow.: Movie.java, Genre.html, ControllerServlet and
DisplayMovieList.jsp
Movie.java provides a bean/class data members, accessors, mutators, toString,
default and parameterized constructor as required.
Genre.html provides a list of movie genres to the user to choose from. Send the
chosen genre as request parameter to ControllerServlet.
ControllerServlet contains a list of movies according to genre. Set a request
scope attribute “mymovies” with the array of movies of the chosen genre.
Forward the request to DisplayMovieList.jsp
DisplayMovieList.jsp displays the names of movies by getting them from the
attribute “mymovies”.
6 Working with JSP and Listeners 2
1. Write a web based java application containing a JSP which performs the simple
arithmetic calculation for given arguments and operator. Write your JSP code using
jsp:useBean action tag.
2. Write a web based Java application which registers and displays the number of hits
made by clients since that application has been started by container. [Use
ServletContextListener].
3. Write a web based Java application which logs the request creation and its destruction.
7 Working with HttpSession 2
Write a Java web application using HttpSession which allows only logged in user to access
the other JSPs/Servlets of the application. Write the following components:
Login.html allows user to provide username and password and send them as request
parameters toLoginVerifierServlet.
LoginVerifierServlet takes username and password from login.html and verifies it. If
credentials are correct then it creates a session. It displays welcome message along
with username and links to first.jsp and second.jsp.
first.jsp and second.jsp display some random messages and can be accessed if user is
logged in. ( you should delegate to Login.html if the user is not loggedin)
8 Working with Scriptless jsp 2
1. Write a scriptless jsp to display the words in uppercase and the word-count (no. of
words) of the text written in atextbox.
e.g. in textbox "This is Scriptless JSP" is entered by the user.
Words:
THIS
IS
SCRIPTLES
S
JSP
Count:4
2. Write a web application that takes the user’s name and age from a form. It echoes back
the name and age along with a message stating the price of amusement park tickets. The
price is determined by the age passed by the user. Application should not contain any
javacode.
If the age is greater than 62, the ticket price is INR100.00
If the user is less than 10 years old, the price is INR50.00
For everyone else, the price is INR300.00
3. Write a tag based solution to display wordOfTheDay. Have dummy word list attached
per week days.
9 Working with Tag file and SimpleTagSupport 2
1. Write a web based java application for demonstrating use of tag file. This application
must contain the following components:
Color.java: It represents a color bean with properties name and rgb.
setColors.java: It is a servlet which creates an ArrayList of color bean objects and
set it as a request scoped attribute. It forwards the request to the
ShowColorTagDemo.jsp.
ShowColorTagDemo.jsp: It invokes the showColor.tag by passing request scoped
attribute as an attribute to tag file.
showColor.tag: It is a tag file which takes an arraylist of color bean objects as an
attribute and prints the name and rgb properties of each color object.
2. Write a java web application for simple calculator (i.e. +, -, *, /) using S. Your
application must have following components.
Input.jsp: which takes arguments and operator as input and submit it to
calculate.jsp
Calculate.jsp: it calls the custom tag calculate with arguments and operator as
attributes.
MyCalculator.java: it handles the simple custom tag calculate and prints the result.
Mytags.tld: it describe the simple custom tag calculate
10 Working with Filters & Introduction to Spring Framework 2
1. Write a filter to check whether user has logged in. Whenever user makes a request for
any web resource, the filter is activated. However, filter must not be activated when
login.html or LoginServlet is called as it is used to process the login. Filter checks
whether the requested URL is login.html or LoginSerevlet, if so it does nothing
otherwise it checks whether user has logged in. Session attribute logged indicated
whether user has logged or not. Assume that attribute logged is set in session in
LoginSerevlet during the login process.
2. Write a filter to display the total request processing time for any web resource.
3. Develop a “HelloWorld” application using Spring Framework.
11 Working with Hibernate 2
1. Develop Spring framework based Java application. Utilize Dependency Injections; Also Aspect
Oriented Programming in your design for cross-cutting concerns.
Class with properties:
triangle ( type – Equilateral, Bilateral, etc.) and circle ( center (x,y) and radius)
Class to provide collective service
ShapeService having dependencies triangle and circle.
Assuming all properties being priority information, which need to be audited, generate artifacts
(Console Output using syso) of usage for the same.
(Hint. Use AOP. Practice various types of advice. i.e. After, Before. Etc.)
Write a DemoSpring class having main method. Create spring application context and retrieve
object (spring bean) ShapeService. Invoke getter methods to verify artifact generation.
2. Study and exercising Spring Web MVC based Java web application from the demo shared.