CT WT Lab
CT WT Lab
Cheeryal (V), Keesara (M), Ranga Reddy District – 501 301 (T.S)
WEB TECHNOLOGIES
LABORATORY MANUAL
DEPARTMENT OF
1
Geethanjali College of Engineering and Technology
Department of COMPUTER SCIENCE & ENGINEERING
Prepared by : Modified by :
1) Name : S.Ramanjaneyulu 1) Name : G. Lokeshwari
2) Sign : 2) Sign :
3) Design : Asst. Prof 3) Design : Assoc. Prof
4) Date : 4) Date :
Approved by : (HOD )
1) Name :
2) Sign :
3) Date
2
WEB TECHNOLOGIES
LAB
3
List of Lab Exercises
Web Technologies
1 Design the following static web pages required for an online book
store web site:1)Homepage 2)Four navigation links 3)catalogue
page
2 Design the following static web pages required for an online book
store web site:4) CART PAGE 5) REGISTRATION PAGE:
3 VALIDATION:
Write JavaScript to validate the following fields of the above
registration page.
1. Name (Name should contains alphabets and the length should
not be less than 6 characters).
2. Password (Password should not be less than 6 characters length).
3. E-mail id (should not contain any invalid and must follow the
standard pattern [email protected])
4. Phone number (Phone number should contain 10 digits only).
4 Design a web page using CSS (Cascading Style Sheets) which
includes the following:
1) Use different font, styles:
2) Set a background image for both the page and single elements
on the page.
3) Control the repetition of the image with the background-repeat
property.
4) Define styles for links as
5) Work with layers:
6) Add a customized cursor: Selector {cursor: value}
5 Write an XML file which will display the Book information which
4
includes the following: 1) Title of the book 2) Author Name
3) ISBN number 4) Publisher name 5) Edition 6) Price
Write a Document Type Definition (DTD) to validate the above
XML file.
6 VISUAL BEANS:
Create a simple visual bean with a area filled with a color.
The shape of the area depends on the property shape. If it is set to
true then the shape of the area is Square and it is Circle, if it is
false.
The color of the area should be changed dynamically for every
mouse click. The color should also be changed if we change the
color in the “property window “.
7 1) Install TOMCAT web server and APACHE.
While installation assign port number 4040 to TOMCAT and 8080
to APACHE. Make sure that these ports are available i.e., no other
process is using this port.
2) Access the above developed static web pages for books web
site, using these servers by putting the web pages developed in
Exp-1 and Exp-2 in the document root.
Access the pages by using the urls :
http://localhost:4040/rama/books.html (for tomcat)
http://localhost:8080/books.html (for Apache)
8 User Authentication:
Assume four users user1, user2, user3 and user4 having the
passwords pwd1, pwd2, pwd3 and pwd4 respectively. Write a
servelet for doing the following.
1. Create a Cookie and add these four user ids and passwords to
this Cookie.
2. Read the user id and passwords entered in the Login form
(Exp1) and authenticate with the values (user id and passwords)
available in the cookies.
5
9 Install a database (Mysql or Oracle).
Create a table which should contain at least the following fields:
name, password, email-id, phone number (these should hold the
data from the registration form).
Practice 'JDBC' connectivity.
Write a java program/servlet/JSP to connect to that database and
extract data from the tables and display them. Experiment with
various SQL queries. Insert the details of the users who register
with the web site, whenever a new user clicks the submit button in
the registration page (Exp2).
10 Write a JSP which does the following job:
Insert the details of the 3 or 4 users who register with the web site
(Exp9) by using registration form. Authenticate the user when he
submits the login form using the user name and password from the
database (similar to Exp8 instead of cookies).
11 Create tables in the database which contain the details of items
(books in our case like Book name, Price, Quantity, Amount) of
each category. Modify your catalogue page (Exp 2) in such a way
that you should connect to the database and extract data from the
tables and display them in the catalogue page using JDBC.
12 HTTP is a stateless protocol. Session is required to maintain the
state. The user may add some items to cart from the catalog page.
He can check the cart page for the selected items. He may visit the
catalogue again and select some more items. Here our interest is
the selected items should be added to the old cart rather than a new
cart. Multiple users can do the same thing at a time (i.e., from
different systems in the LAN using the ip-address instead of local
host). This can be achieved through the use of sessions. Every user
will have his own session which will be created after his successful
login to the website. When the user logs out his session should get
invalidated (by using the method session.invalidate( ) ).
6
ADDITIONAL PROGRAMS
Web Technologies
3
Design and develop a JSP program for arithmetic.
7
1. To provide graduates with a good foundation in mathematics, sciences and engineering
fundamentals required to solve engineering problems that will facilitate them to find
employment in industry and / or to pursue postgraduate studies with an appreciation for
lifelong learning.
2. To provide graduates with analytical and problem solving skills to design algorithms,
other hardware / software systems, and inculcate professional ethics, inter-personal skills
to work in a multi-cultural team.
3. To facilitate graduates to get familiarized with the art software / hardware tools, imbibing
creativity and innovation that would enable them to develop cutting-edge technologies of
multi-disciplinary nature for societal development.
PROGRAM OUTCOMES
Software’s
1. A Web Browser either IE or Firefox.
2. Tomcat Web Server & Apache Web Server.
3. XML editor like Xml-spy.
4. A data base either Mysql or Oracle.
5. JVM (Java Virtual Machine).
6. BDK (Bean Development Kit).
Objectives & Outcomes of the Web technologies & Compiler Design Lab Course
Objectives of the Web technologies & Compiler Design Lab Course
To create a fully functional website with mvc architecture.
To develop an online Book store using we can sell books (Ex amazon .com).
Outcomes of the Web technologies & Compiler Design Lab Course:
9
Ability to design and implement a basic website.
Implement different navigation strategies on website.
Develop a simple bean application
Effectively use client-side technologies (XHTML, CSS, forms and JavaScripts)
to implement static websites.
Use server-side technologies (Servlets and JSP) to implement dynamic websites.
Develop simple back-end database to support a website.
Recognize and evaluate website organizational structure and design elements.
Create an XML application.
10
Mapping of Lab Course with Programme Educational Objectives
Professional WEB
1 56610 II √ √ √
core TECHNOLOGIES
1, 2, 3 & 4 CO56610.1: Students HTML tags, CSS, JAVA: PO2, PO3, PO4,
will able to design web JavaScript AWT and PO5, PO6, PO8,
pages for a static web Regular Swings. PO9, PO11, PO12,
site, validate the user Expressions PO13,PO14
information by regular
expressions and apply
different styles to web
pages by css.
5&6 CO56610.2: eXtensible Setter and Getter PO2, PO3, PO5,
Students will gain the Markup methods in java PO6, PO8, PO11,
knowledge of storing Language, PO12, PO13, PO14
and transforming JavaBean
information through
web and create a simple
bean and reusing this for
multiple bean
applications
7&8 CO56610.3: Web Servers: PO2, PO3, PO5,
Students will able to Apache Tomcat, PO6, PO8, PO11,
know the installation of Servlets: Cookie PO12, PO13, PO14
web servers for
maintaining the web
pages and how the user
information is stored in
cookie, when user send
11
requests to the server
9 & 10 CO56610.4: Servlet, Jsp, Database PO2, PO3, PO5,
Students will able to JDBC Management PO6, PO8, PO11,
connect database with Systems PO12, PO13, PO14
jsp/servlet to retrieve the
data from data base and
know the authentication
process of the user when
login into the webpage
11 & 12 CO56610.5: HTML, JDBC, PO2, PO3, PO5,
Students will able to Servlets : Session PO6, PO8, PO11,
analyze how the data is Tracking PO12, PO13, PO14
extracted from the tables
for doing computations
on it and maintain the
state of the user by using
stateless protocol.
12
Geethanjali College of Engineering & Technology
Department of Computer Science & Engineering
LAB OCCUPANCY SHEET
LUNCH
Wedne III YEAR CSE A
sday WT&CD LAB
Thursd
ay
III YEAR CSE C
Friday WT&CD LAB
Saturd
ay
13
WEEK 1
AIM
Design the following static web pages required for an online book store web site.
1) HOME PAGE: The static home page must contain three frames.
Top frame: Logo and the college name and links to Home page, Login page, Registration
page, Catalogue page and Cart page (the description of these pages will be given below).
Left frame: At least four links for navigation, which will display the catalogue of respective
links.
For e.g.: When you click the link “CSE” the catalogue for CSE Books should be displayed
in the Right frame.
Right frame: The pages to the links in the left frame must be loaded here. Initially this page
contains description of the web site.
2) LOGIN PAGE:
3) CATOLOGUE PAGE:
The catalogue page should contain the details of all the books available in the web site in a
table.
The details should contain the following:
1. Snap shot of Cover Page. 2. Author Name. 3. Publisher. 4. Price. 5. Add to cart button.
Objectives:
Student will able to learn
To use HTML tags and tag attributes to control a Web page’s appearance.
To add absolute URLs, relative URLs, and named anchors to your Web
pages.
14
Outcomes:
Student gains the knowledge to use HTML tags and tag attributes to control a Web
page’s appearance.
Algorithm:
Step1: Start
Step3: Create frames Using <FRAMESET> tag divides the html page as preferred.
Step4: In top frame include the image of the college in the html document using
the <img> tag and create links as home, login, register, catalogue and cart page.
Step5: In left frame create links as CSE, IT etc. and display the menu in the left
side of the window.
Step6: Make the respective forms to be displayed in the right side of web page
when the menu is clicked.
Step7: Stop.
VIVA QUESTIONS:
15
WEEK 2
AIM
Design the following static web pages required for an online book store web site.
4) CART PAGE: The cart page contains the details about the books which are added to the
cart.
5) REGISTRATION PAGE: Create a “registration form “with the following fields
1) Name (Text field) 2) Password (password field) 3) E-mail id (text field) 4) Phone number
(text field) 5) Sex (radio button) 6) Date of birth (3 select boxes) 7) Languages known
(check boxes – English, Telugu, Hindi, Tamil) 8) Address (text area)
Objectives:
Student will able to learn
To use HTML tags and tag attributes to control a Web page’s appearance.
To add absolute URLs, relative URLs, and named anchors to your Web
pages.
Outcomes:
Student gains the knowledge to use HTML tags and tag attributes to control a Web
page’s appearance.
Algorithm:
Step1: Start
Step3: Create frames Using <FRAMESET> tag divides the html page as preferred.
Step4: In top frame include the image of the college in the html document using
the <img> tag and create links as home, login, register, catalogue and cart page.
16
Step5: In left frame create links as CSE, IT etc. and display the menu in the left
side of the window.
Step6: Make the respective forms to be displayed in the right side of web page
when the menu is clicked.
Step7: Stop.
VIVA QUESTIONS:
WEEK 3
AIM
VALIDATION:
Write JavaScript to validate the following fields of the above registration page.
1. Name (Name should contains alphabets and the length should not be less than 6
characters).
2. Password (Password should not be less than 6 characters length).
3. E-mail id (should not contain any invalid and must follow the standard pattern
[email protected])
4. Phone number (Phone number should contain 10 digits only).
Student will able to learn about JavaScript that can be used to validate data in
HTML forms before sending off the content to a server.
17
Outcomes:
Algorithm:
Step1: Start
Step5: When the user submits the form, the register event handler captures the
event and calls the validate ( ) function, passing in the form object.
Step6: The validate ( ) function stores the form object in the form variable.
Step7: The values entered into the Username and Password fields are stored in
variables (username and password).
Step8: An if condition is used to check if username is an empty string the
function returns false and the function stops processing and the form
does not submit.
Step9: If neither if condition catches a problem, the function returns true and
the form submits.
Step12: Stop.
18
VIVA QUESTIONS:
Week4
AIM
Design a web page using CSS (Cascading Style Sheets) which includes the following:
1) Use different font, styles: In the style definition you define how each selector should
work (font, color etc.). Then, in the body of your pages, you refer to these selectors to
activate the styles.
2) Set a background image for both the page and single elements on the page.
3) Control the repetition of the image with the background-repeat property.
As background-repeat: repeat Tiles the image until the entire page is filled, just like an
ordinary background image in plain HTML.
4) Define styles for links as A:link A:visited A:active A:hover
Example: <style type="text/css"> A:link {text-decoration: none} A:visited {text-
decoration: none} A:active {text-decoration: none} A:hover {text-decoration: underline;
color: red;} </style>
5) Work with layers:
For example: LAYER 1 ON TOP: <div style="position:relative; font-size:50px; z-
index:2;">LAYER 1</div> <div style="position:relative; top:-50; left:5; color:red; font-
size:80px; z- index:1">LAYER 2</div> LAYER 2 ON TOP: <div style="position:relative;
font-size:50px; z-index:3;">LAYER 1</div> <div style="position:relative; top:-50; left:5;
color:red; font-size:80px; z- index:4">LAYER 2</div>
19
6) Add a customized cursor: Selector {cursor: value}.
Objectives
Outcomes:
Algorithm:
Step1: Start
Step7: Stop.
VIVA QUESTIONS:
20
2. What is the difference between POST and GET method?
3. What are the input type componenets in FORM?
4. What is the mandatory attribute in <form>?
5. What are the attributes of <form>?
6. What is CSS?
7. What are the advantages of CSS?
8. What are the types of CSS?
9. What is the Syntax of CSS?
10. What are the properties of table in CSS?
Week5
AIM
Write an XML file which will display the Book information which includes the following:
1) Title of the book 2) Author Name 3) ISBN number 4) Publisher name 5) Edition 6) Price
Write a Document Type Definition (DTD) to validate the above XML file.Display the XML
file as follows.The contents should be displayed in a table. The header of the table should
be in color GREY and the Author names column should be displayed in one color and
should be capitalized and in bold. Use your own colors for remaining columns.Use XML
schemas XSL and CSS for the above purpose.
Objectives:
About XML i.e. is used to share data more effectively between software
applications
About XML's role in relation to the web-based technologies you are already
familiar with
Document-based middleware.
Graphical user interface format.
Elements and attributes and describe how they structure an XML document
21
Outcomes:
Student gains the ability
To implement XML.
To manipulate XML elements and documents at run-time.
About practical experience in working with XML and will be competent in
working with XML as well as being able to work with XML
programmatically.
Algorithm:
Step1: Start
Step4: Include all the information using various html tags in books.xml.
Step9: Stop.
22
VIVA QUESTIONS
1. What is XML?
2. Difference between XML and HTML?
3. Structure of XML document.
4. What is DTD?
5. Difference between SAX and DOM parsers?
Week6
AIM
VISUAL BEANS:
Create a simple visual bean with a area filled with a color.
The shape of the area depends on the property shape. If it is set to true then the shape of
the area is Square and it is Circle, if it is false.
The color of the area should be changed dynamically for every mouse click. The color
should also be changed if we change the color in the “property window “.
23
Week7
AIM
1) Install TOMCAT web server and APACHE. While installation assign port number 4040
to TOMCAT and 8080 to APACHE. Make sure that these ports are available i.e., no other
process is using this port.
2) Access the above developed static web pages for books web site, using these servers by
putting the web pages developed in week-1 and week-2 in the document root.
Objectives:
Outcomes:
Algorithm:
Step1: Start.
24
Step6: Set class path set
classpath=%classpath%;.;%$CATALINA_HOME%\common\lib\servlet-api.jar.
Web-apps->wtlab->src->lib->classes.
Step10: Copy java file in src folder and .class file in classes folder.
Step12: Give folder name and java filename near 8080 .It shows folder in
application click on folder it displays output as Hello World!
Step13: Stop.
VIVA QUESTIONS
1. What is servlet?
2. Advantages of servlet.
3. Explain servlet life cycle?
4. Explain servlet directory structure?
5. What is the purpose of web.XML in servlets?
Week8
AIM
User Authentication:
Assume four users user1, user2, user3 and user4 having the passwords pwd1, pwd2, pwd3
and pwd4 respectively. Write a servelet for doing the following.
25
1. Create a Cookie and add these four user ids and passwords to this Cookie.
2. Read the user id and passwords entered in the Login form (Exp1) and authenticate with
the values (user id and passwords) available in the cookies.
If he is a valid user (i.e., user-name and password match) you should welcome him by name
(user-name) else you should display “You are not an authenticated user “. Use init-
parameters to do this. Store the user-names and passwords in the webinf.xml and access
them in the servlet by using the getInitParameters() method.
Objectives:
Outcomes:
Student gains the knowledge about Session tracking i.e. easy to implement and
maintain using the cookies.
Algorithm:
Step1: Start
26
Step9: Open Program files->Apache Software foundation->Tomcat5.5->
Web-apps->wtlab->src->lib->classes.
Step10: Copy java file in src folder and .class file in classes folder.
Step12: Give folder name and java filename near 8080 .It shows folder in
application click on folder it displays output.
Step13: Stop.
VIVA QUESTIONS
Week9
AIM
Install a database (Mysql or Oracle).
Create a table which should contain at least the following fields: name, password, email-id,
phone number (these should hold the data from the registration form). Practice 'JDBC'
connectivity.
Write a java program/servlet/JSP to connect to that database and extract data from the
tables and display them. Experiment with various SQL queries. Insert the details of the
users who register with the web site, whenever a new user clicks the submit button in the
registration page (Exp2).
27
Objectives:
Student will able to learn update relational data using jdbc to execute select and
insert queries.
Outcomes:
Student gains the knowledge about JDBC to execute common SQL statements and
perform other objectives common to database applications.
Algorithm:
Step1: Start
.Step3: Open Administrative Tools in Control Panel and click on Set up data
sources (ODBC).
Step4: Click on Add in System DSN tab. Select the Oracle Driver name and click
on finish.
Step5: Enter the required Data Source Name and click on OK.
Step6: Compile as javac Type4InsRet.java,run as java Type4InsRet and displays
output.
Step7: Stop.
VIVA QUESTIONS
1. What is JDBC?
2. Explain the steps to create JDBC application?
3. What is the purpose of execute()?
4. What is the purpose of executeQuery()?
5. What is the purpose of executeUpdate()?
28
Week10
AIM
Write a JSP which does the following job:
Insert the details of the 3 or 4 users who register with the web site (Exp9) by using
registration form. Authenticate the user when he submits the login form using the user
name and password from the database (similar to Exp8 instead of cookies).
Objectives:
Student will able to learn to connect a database using jdbc and perform simple
query.
Outcomes:
Algorithm:
Step1: Start
Step3: Open Administrative Tools in Control Panel and click on Set up data
sources (ODBC).
Step4: Click on Add in System DSN tab. Select the Oracle Driver name and click
on finish.
Step5: Enter the required Data Source Name and click on OK.
Step6: Open http://localhost:8080/JDBC/store.html enter the details in register
form click on save to database and displays the output.
Step7: Stop.
29
VIVA QUESTIONS
1. What is JDBC?
2. What are types of JDBC?
3. What are JSP directives?
4. What are JSP scriptlets?
5. What are steps to create JDBC applications?
Week11
AIM
Create tables in the database which contain the details of items (books in our case like Book
name, Price, Quantity, Amount) of each category. Modify your catalogue page (Exp 2) in
such a way that you should connect to the database and extract data from the tables and
display them in the catalogue page using JDBC.
Objectives:
Student will able to learn update relational data using jdbc to execute select and
insert queries.
Outcomes:
Student gains the knowledge about JDBC to execute common SQL statements and
perform other objectives common to database applications.
Algorithm:
Step1: Start
30
Step2: Create Type4InsRet.java
.Step3: Open Administrative Tools in Control Panel and click on Set up data
sources (ODBC).
Step4: Click on Add in System DSN tab. Select the Oracle Driver name and click
on finish.
Step5: Enter the required Data Source Name and click on OK.
Step6: Compile as javac Type4InsRet.java,run as java Type4InsRet and displays
output.
Step7: Stop.
VIVA QUESTIONS
1. What is JDBC?
2. Explain the steps to create JDBC application?
3. What is the purpose of execute()?
4. What is the purpose of executeQuery()?
5. What is the purpose of executeUpdate()?
Week12
AIM
HTTP is a stateless protocol. Session is required to maintain the state. The user may add
some items to cart from the catalog page. He can check the cart page for the selected items.
He may visit the catalogue again and select some more items. Here our interest is the
selected items should be added to the old cart rather than a new cart. Multiple users can do
the same thing at a time(i.e., from different systems in the LAN using the ip-address instead
of local host). This can be achieved through the use of sessions. Every user will have his
own session which will be created after his successful login to the website. When the user
logs out his session should get invalidated (by using the method session.invalidate() ).
Modify your catalogue and cart JSP pages to achieve the above mentioned functionality
using sessions.
Objectives:
31
Student will able to learn to implement a servlet program to demonstrate the
session tracking using sessions.
Outcomes:
Algorithm:
Step1: Start
Web-apps->wtlab->src->lib->classes.
Step10: Copy java file in src folder and .class file in classes folder.
32
Step12: Give folder name and java filename near 8080 .It shows folder in
application click on folder it displays output.
Step13: Stop.
VIVA QUESTIONS
33
ADDITIONAL PROGRAMS
34
AIM:
Objectives:
Outcomes:
Algorithm:
Step1: Start.
Document.getElementById (“demo”{).innerHTML=Date();
Step8: Stop.
35
AIM:
Objectives:
Outcomes:
Algorithm:
Step1: Start.
Step5: Close all tags as </font> </body> </title> </head> and </html>.
Step6: Stop.
36
AIM:
Objectives:
Outcomes:
Algorithm:
Step1: Start.
<table border=”1”>
<th><td><b>EL expression</b></td>
<td><b>result</b></td></th>
Step7: Stop.
37