WT Lab Manual Overall
WT Lab Manual Overall
ENGINEERING
LAB MANUAL
for
CCS375 – WEB TECHNOLOGIES LABORATORY
(Regulation 2021 – V Semester)
i
INDEX
Page
S. No NAME OF THE EXPERIMENTS No
Create a webpage with the following using HTML.
To embed an image map in a webpage.
1. To fix the hot spots.
Show all the related information when the hotspots are clicked.
3. Client Side Scripts for Validating Web Form Controls using DHTML.
ii. For displaying student mark list. Assume that student information is
available in a database which has been stored in a database server
ii
CCS375 WEB TECHNOLOGIES LABORATORY
OBJECTIVES
LIST OF EXPERIMENTS
TOTAL: 30 PERIODS
OUTCOMES: At the end of the course, the student should be able to
CO1: Construct a basic website using HTML and Cascading Style Sheets CO2:
Build dynamic web page with validation using Java Script objects and by
applying differentevent handling mechanisms.
CO3: Develop server side programs using Servlets and JSP.
CO4: Construct simple web pages in PHP and to represent data in XML format.
CO5: Develop interactive web applications.
iii
EX.NO:1 CREATING A WEB PAGE USING IMAGE
MAP DATE:
ALGORITHM:
Step 1: Open notepad and type the HTML coding for homepage home. Html which has
an image map using<MAP>tag and create some hotspots
Step 2: Hotspots are created by including a link at required coordinate position using
<a> tag which directs to its corresponding web pages
Step 3: Write the coding for all the link web pages
Step 4: Run the home. Html in suitable web browser
Step 5: Display output.
PROGRAM:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Home - States of India</title>
</head>
<body bgcolor="gold">
<h1><u><center>Republic of India</center></u></h1>
<p>
India is the seventh largest country in the world by
geographical area, the second most populous country with over 1.3
billion people. India is a vast South Asian country with diverse
terrain – from Himalayan peaks to the Indian Ocean coastline –
and a history reaching back 5 millennia. India is a federal
constitutional republic with a parliamentary democracy consisting
of 28 states and 7 Union Territories.
</p>
<center>
<img width="275" height="290" alt="Map of India"
src="IndiaMap.jpg" usemap="#india">
<map name="india">
<area shape="circle" coords="28,65,145"
href="ANDHRAPRADESH.html" alt="Learn about Andhra
Pradesh">
<area shape="circle" coords="54,73,165"
4
href="KERALA.html" alt="Learn about Kerala">
<area shape="circle" coords="99,186,216"
href="KARNATAKA.html" alt="Learn about Karnataka">
<area shape="circle" coords="19,159,88"
href="TAMILNADU.html" alt="Learn about Tamil Nadu">
</map>
</center>
<h2>Features</h2>
<ul>
<li><b>Population</b> - 133.92 crores (2019)</li>
<li><b>Capital</b> - New Delhi</li>
<li><b>Largest City</b> - Mumbai</li>
<li><b>Currency</b> - Indian Rupee</li>
<li><b>Time Format</b> - IST (UTC+5:30)</li>
<li><b>National Sport</b> - Hockey</li>
<li><b>Current PM</b> - Narendra Modi</li>
<li><b>Current President</b> - Pranab Mukherjee</li>
</ul>
<h2><b>To view details of southern states, please click on the
specified area in the map!</b></h2>
</body>
</html>
Tamilnadu.html
<html>
<head><title>TamilNadu-India</title></head>
<body bgcolor="palegreen">
<h1><center>TamilNadu</center></h1>
<h3>isoneofthe29statesofIndia.ItscapitalandlargestcityisChennai.TamilNadulies
inthesouthernmostpartoftheIndianPeninsulaand
ItisborderedbytheStatesofPuducherry,Kerala,Karnataka,AndhraPradesh
</h3><h3>
<ul>
5
<li>Districts<i>-37</i>
<li>CapitalCity<i>-Chennai</i>
<li>LargestCity<i>-Chennai</i>
<li>Governor<i>-BanwarilalPurohit</i>
<li>ChiefMinister<i>-Palanisamy</i>
<li>Population<i>-80,351,195</i>
<li>Touristspots<i>-
Mamallapuran,Ooty,Kodaikanal,Marina,MuduraiMeenakshiAmmanTem
ple,Thanjavuretc.,</i>
</ul>
<ahref="Home.html">back</a>
</body>
</html>
andhrapradesh.html
<html>
<head><title>AndhraPradesh-India</title></head>
<bodybgcolor="tan">
<h1><center>AndhraPradesh</center></h1>
<h3>A.P.,isastatesituatedonthesoutheasterncoastofIndia.ItisIndia'sfourthl
argeststatebyareaandfifthlargestbypopulation.</h3>
<h3>
<ul>
<li>Districts<i>-13</i>
<li>CapitalCity<i>-Hyderabad</i>
<li>LargestCity<i>-Hyderabad</i>
<li>Governor<i>-BISWABHUSANHARICHARAN</i>
<li>ChiefMinister<i>-Y.S.JAGANMOHANREDDY</i>
<li>Population<i>-91,103,010</i>
<li>Touristspots<i>-
TirumalaTirupati,Guntur,GolcondaFort,Chandragiri,Arakuvalley,F
alaknumaPalaceetc.,</i>
</ul>
<ahref="Home.html">back</a>
6
</body> </html>
Karnataka.html
<html>
<head><title>Karnataka-India</title></head>
<body bgcolor="wheat">
<h1><center>Karnataka</center></h1>
<h3> <ul>
<li>Districts<i>-30</i>
<li>CapitalCity<i>-Bangalore</i>
<li>LargestCity<i>-Bangalore</i>
<li>Governor<i>-VajubhaiVala</i>
<li>ChiefMinister<i>-B.S.YEDIYURAPPA</i>
<li>Population<i>- 68,308,304</i>
<li>Touristspots<i>-GolGumbaz,MysorePalace,KeshavaTempleetc.,</i>
</ul>
</h3>
<ahref="Home.html">back</a>
</body>
</html>
Kerala.html
<html>
<head><title>Kerala-India</title></head>
<body bgcolor="indianred">
<h1><center>Kerala</center></h1>
<h3>
<ul>
<li>Districts<i>-14</i>
<li>CapitalCity<i>-Thiruvanandapuram</i>
<li>LargestCity<i>-Thiruvanandapuram</i>
<li>Governor<i>-ARIFMOHAMMADKHAN</i>
<li>ChiefMinister<i>-PINARAYIVIJAYAN</i>
<li>Population<i>-34,545,868</i>
<li>Touristspots<i>-
7
EdakkalCaves,Palayur,KovalamBeach,Munnar,Kochi,Alapuzhaetc.,</i>
</ul>
<a href="Home.html">back</a>
</h3>
</body>
</html>
OUTPUT:
8
Result :
Thus a web page with given specifications was created and its output was
verified
9
EX.NO: 2 CREATING A WEBPAGE WITH CASCADING STYLE SHEET
DATE :
AIM:
To create a webpage with the following using html to embedded the style sheet
ALGORITHM:
Step1: Create html file with the style tag, inside head tag.
Step2: Set the style such as font-family, font-size, color, left etc, for the
Step4: Specify the heading and information required inside the body tag.
PROGRAM:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Embedded Style Sheet</title>
<style type="text/css">
h1 {
font-family: Arial;
color: green;
text-align: center;
}
h2 {
font-family: Arial;
color: red;
margin-left: 20px;
}
h3 {
font-family: Arial;
color: blue;
}
p{
font-size: 14pt;
font-family: Verdana;
}
</style>
</head>
<body>
1
0
<h1>This is created using an embedded style sheet</h1>
<h2>This line is aligned left and red colored</h2>
<p>
The embedded style sheet is the most commonly used style sheet. This paragraph is written in Verdana
font with a font size of 14.
</p>
<h3>
This is a blue <a href="colorname.html">colored</a> line
</h3>
</body>
</html>
OUTPUT:
RESULT: Thus creation of an webpage using cascading style sheet has been
developed successfully.
1
1
EX.NO :3 CLIENT-SIDE SCRIPTS for validating web form control using
DHTML DATE:
AIM:
PROGRAM:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Web Forms</title>
<style>
body {
text-align: center;
font-family: Arial, sans-serif;
}
form {
display: inline-block;
text-align: left;
margin-top: 50px;
}
.form-group {
margin: 10px 0;
}
label {
float: left;
width: 40%;
text-align: right;
padding-right: 10px;
}
12
input[type="submit"] {
margin-top: 20px;
width: auto;
clear: both;
}
.clearfix::after {
content: "";
display: table;
clear: both;
}
</style>
<script type='text/javascript'>
function formValidator() {
var firstname = document.getElementById('firstname');
var lastname = document.getElementById('lastname');
var addr = document.getElementById('addr');
var zip = document.getElementById('zip');
var Countries = document.getElementById('Countries');
var username = document.getElementById('username');
var email = document.getElementById('email');
var dd = document.getElementById('dd');
var mm = document.getElementById('mm');
var yyyy = document.getElementById('yyyy');
var comment = document.getElementById('comment');
var password = document.getElementById('password');
13
function notEmpty(elem, helperMsg) {
if (elem.value.length === 0) {
alert(helperMsg);
elem.focus();
return false;
}
return true;
}
16
OUTPUT:
17
RESULT :
Thus developing client side scripts for validating web from
controls usingDHTML has been verified.
18
EX.NO :4 INSTALLING & CONFIGURING TOMCAT - WEBSERVER
DATE:
AIM:
19
Step 1: Visit Apache Tomcat home page with a Web browser, and click the "Download"
link under the "Tomcat 7.0.70 Released" section. You will see the"Tomcat 7
Downloads"
page.
Step 2: Click "32-bit Windows zip" link under "Binary Distributions" section. Youwill see the
download file save dialog box.(this supports jdk1.6 kit)
Step 3: Use the "Save file" option to save the download file
"apache-tomcat-7.0.70-windows-x86.zip" to a temporary folder.
Step 4: Unzip "apache-tomcat-7.0.70-windows-x86.zip" to file installation folder“C:\
apache-tomcat-7.0.70”.
Step 5: Try to start Tomcat server by running the "startup" command in acommand
linewindow:
C:\ >cd apache-tomcat-7.0.70\bin
C:\ >cd apache-tomcat-7.0.70\bin>startup
The CATALINA_HOME environment variable is not defined correctlyThis
environment variable is needed to run this program
Step 6: To fix the missing environment variables, CATALINA_HOME,JAVA_HOME &
JRE_HOME,
● Click my computer->right click properties->Select Advance SystemSetting
● In this tab, Click Environment variable
● Click new in User variables for admin
● Enter variable name & Variable value
▪ CATALINA_HOME C:\apache-tomcat-7.0.70
▪ JAVA_HOME C:\Program Files\Java\
▪ JRE_HOME C:\Program Files\Java\jre7
Step 7: Configuring Tomcat
Open “C:\apache-tomcat-7.0.70\conf”
Folder It consist of the following xml files
Server.xml
Web.xml
Tomcat-
user.xml
Context.xm
l
Open web.xml in notepad & modify default-listings-false to true
Open server.xml & change port number 8080 to any other (8081) if any
application access thesame port Open context.xml change reloadable attribute to
true on figurationprocedure varies according to the version
Step 8: Try to start Tomcat server by running the "startup" command in a command
Line window:
OUTPUT:
20
RESULT:
Thus the Tomcat server is installed and configured successfully
21
EX.NO : 5 A INVOKING SERVLET FROM HTML FORMS
DATE:
AIM:
Step1: In html program, define the html, head and title tag.
Step2: Then the title is Student Information Form and close the title and head tag.
Step3: Define the body tag inside the body tag create form
and table simultaneously.
Step4: The table consists of following information Roll no, Student
name, Address, Phone no and total marks.
Step5: In the servlet program, import the summary package and create
a ownservlet class extends with generic servlet.
Step6: In the service method defined to request and response.
Step7: Create the object and for print writer and get writer()value.
Step8: The enumeration object get the servlet request parameter.
Step9: Create objects for string method and it is displayed another
object valuereceived get parameter of name received and
displayed the value received value.
PROGRAM:
//index.jsp
<html>
<head>
<title>Processing get requests with data</title>
</head>
<body>
<form action = "Servlet3" method = "get">
<b><p><label>Enter Your name Please!!
<br />
22
<input type = "text" name = "firstname" />
<input type = "submit" value = "Submit" />
</label></p></b>
</form>
</body>
</html>
//Servlet3.java
Import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException; import
javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse;
public class Servlet3 extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponseresponse)
throws ServletException, IOException {
String firstName = request.getParameter( "firstname"
);response.setContentType( "text/html" );
PrintWriter out = response.getWriter();
// send XHTML document to client
// start XHTML
documentout.println(
"<html>" );
// head section of
documentout.println(
"<head>" );
out.println("<title>Processing get requests with data</title>"
);out.println( "</head>" );
// body section of
documentout.println(
"<body>" );
out.println( "<h1>Hello " + firstName + ",<br />"
);out.println( "Welcome to Servlets!</h1>" );
out.println( "</body>" );
// end XHTML document
out.println( "</html>" );
out.close(); // close stream to complete the page
}
public String
getServletInfo() {
return "Short
description";
}
}
OUTPUT:
23
RESULT: Thus the invocation of servlet from HTML from has been
developedsuccessfully.
AIM:
To write a html program for invoking servlet using html.
ALGORITHM:
STEP 1: Remove a specific attribute You can delete the value associated with a specific key
by
calling the public void remove Attribute(String name) function.
STEP 2:Delete your whole session. To delete an entire session, use the public void invalidate()
function.
STEP 3:Setting Session Timeout You may set the timeout for a session separately by calling
the
public void set MaxInactiveInterval(int interval) function.
STEP 4:Log the user out On servers that support servlets 2.4, you may use the logout method
to
log the client out of the Web server and invalidate all of the users’ sessions.
STEP 4:web.xml Configuration If you’re using Tomcat, you may set the session timeout in the
web.xml file, in addition to the ways listed above.
PROGRAM:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
25
// Check if this is new comer on your web page.
if (session.isNew()) {
title = "Welcome to GeeksForGeeks";
session.setAttribute(userIDKey, userID);
}
else {
visitCount = (Integer)session.getAttribute(
visitCountKey);
visitCount = visitCount + 1;
userID
= (String)session.getAttribute(userIDKey);
}
session.setAttribute(visitCountKey, visitCount);
String docType
= "<!doctype html public \"-//w3c//dtd html 4.0 "
+ "transitional//en\">\n";
out.println(
docType + "<html>\n"
+ "<head><title>" + title + "</title></head>\n"
+
"<tr>\n"
+ " <td>id</td>\n"
+ " <td>" + session.getId() + "</td>"
+ "</tr>\n"
+
"<tr>\n"
+ " <td>Creation Time</td>\n"
+ " <td>" + createTime + " </td>"
+ "</tr>\n"
+
"<tr>\n"
+ " <td>Time of Last Access</td>\n"
+ " <td>" + lastAccessTime + "</td>"
26
+ "</tr>\n"
+
"<tr>\n"
+ " <td>User ID</td>\n"
+ " <td>" + userID + "</td>"
+ "</tr>\n"
+
"<tr>\n"
+ " <td>Number of visits</td>\n"
+ " <td>" + visitCount + "</td>"
+ "</tr>\n"
+ "</table>\n"
+ "</body>"
+ "</html>");
}
}
File: web.xml
XML
<web-app>
<servlet>
<servlet-name>GfgSession</servlet-name>
<servlet-class>GfgSession</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GfgSession</servlet-name>
<url-pattern>/GfgSession</url-pattern>
</servlet-mapping>
</web-app>
Compile the servlet SessionTrack described above and add it to the web.xml file. When you
run http://localhost:8080/SessionTrackingGfg/GfgSession for the first time, you should get the
following result:
Output:
27
If we try to run the same servlet again, we will get the following result.
RESULT:
Thus the invocation of servlet in session tracking been developed successfully.
28
EX.NO : 6 A ONLINE
EXAMINATION DATE:
AIM:
To write a java servlet program to conduct online examination and to
ALGORITHM:
Step4: The 5 question are defined into true or false model and close the all tags.
Step5: Import the necessary packages and declare class, class name in exam.
Step7: Use the deposit () for check the connection in JDBC:ODBC driver.
compilation.
PROGRAM:
//index.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Welcome to Online Examination!!!!</title>
</head>
<body>
Welcome to Online Examination!!!!
<form action="exam" method="get">
<label><p> Enter Your name Please!!<br/>
<input type="text"name="name"/>
<br/>
<input type="submit" name="SUBMIT"/>
</p></label>
</form>
29
</body>
</html>
30
//exam.java
import java.io.IOException;import
java.io.PrintWriter;
import javax.servlet.ServletException; import
javax.servlet.annotation.WebServlet;import
javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import
javax.servlet.http.HttpServletResponse;public class
exam extends HttpServlet {
protected void doGet(HttpServletRequest
request, HttpServletResponseresponse)
throws ServletException, IOException
{ response.setContentType("text/html");
PrintWriter out=response.getWriter();
String
name=request.getParameter("name");
out.println("<html>");
out.println("<head>");
out.println("<title>Online Examination</title>");
out.println("</head>");
out.println("<body bgcolor=PINK>");
out.println("<h2 align=center>Online Examination</h2><hr>");
out.println("<h3 align=center> Welcome
Mr."+name+"</h3><hr>");out.println("<h4><u>Terms and
Conditions:</u></h4>"); out.println("<ul type=disc>");
out.println("<li>The Paper consists a set of five
questions.</li>"); out.println("<li>Every question consists of two
options.</li>"); out.println("<li>All must be
answered</li></ul><hr>"); out.println("<center><h5><u>Your
Questions</u></h5></center>");out.println("<hr>");
out.println("<form method=get action=exam2>");
out.println("<p>1.Operating System is a.................</p>");
out.println("<input type=radio name=q1
value=0>Hardware");out.println("<br>");
out.println("<input type=radio name=q1
value=1>Software");out.println("<hr>");
out.println("<p>2.Developer of C Language is................</p>");
out.println("<br>");
out.println("<input type=radio name=q2
value=0>Dennis Richee");out.println("<br>");
out.println("<input type=radio name=q2
value=1>James Thompson");out.println("<hr>");
out.println("<p>3.Which of the following is a multitasking,multi
user,multiprocessing);
out.println("OS........</p>");
out.println("<br>");
out.println("<input type=radio name=q3
value=0>MS DOS");out.println("<br>");
out.println("<input type=radio name=q3
value=1>Windows NT");out.println("<hr>");
31
out.println("<p>4.Father of Computers is.................</p>");
out.println("<br>");
out.println("<input type=radio name=q4
value=1>Charles babbage");out.println("<br>");
out.println("<input type=radio name=q4
value=0>Charles Dickson");out.println("<hr>");
out.println("<p>5.What is the current generation of computers
?</p>");out.println("<br>");
out.println("<input type=radio
name=q5
value=0>Fifth");out.println("<br>");
out.println("<input type=radio
name=q5
value=1>Sixth");out.println("<hr>");
out.println("<input type=submit
value=Done>");out.println("</form>");
out.println("</body>");
out.println("</html>");
}
public String getServletInfo()
{ return "A Servlet of the
user";
}
}
//exam2.java
import
java.io.IOException;import
java.io.PrintWriter;
import javax.servlet.ServletException;
import
javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse;public
class exam2 extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse
response)
throws ServletException,
IOException {int count=0,j;
response.setContentType("text/html
");PrintWriter
out=response.getWriter(); String
q1=request.getParameter("q1");
String
32
q2=request.getParameter("q2");
String
33
q3=request.getParameter("q3");
String
q4=request.getParameter("q4");
String
q5=request.getParameter("q5");
if(q1.equals("1"))
{
count=count+1;
}
if(q2.equals("1"))
{
count=count+1;
}
if(q3.equals("1"))
{
count=count+1;
}
if(q4.equals("1"))
{
count=count+1;
}
if(q5.equals("1"))
{
count=count+1;
}
out.println("<html>");
out.println("<head><title>Examination
Results</title></head>");out.println("<body>");
out.println("<h2 align=center<Online
Examination</h2><hr>"); out.println("<h3>Number of
Questions answered correctly:</h3>"+count);if(count>=3)
{
out.println("<hr><h3>Congrats!!! You
Have Passed!!!</h3><hr>");
out.println("<h4><b>Try Other Tests!!</b></h4>");
}
else
{
out.println("<hr><h3>Sorry!!! You Have
Failed!!!</h3><hr>");out.println("<h4><b>Try
Again:</b></h4>");
}
34
out.println("</body>");
out.println("</html>");
}
public String getServletInfo()
{ return "A Servlet of the
User";
}
}
OUTPUT:
35
RESULT: Thus the development of program in java to create three
tire applicationusing servlet has been verified successfully.
36
EX.NO : 6 B DISPLAYING STUDENT MARKLIST USING
JSP DATE:
AIM:
To create a three tier application for displaying student mark list using JSP and database.
ALGORITHM:
1. Design the HTML page (stud.html) with the following
a) Create a form to get the input (Register Number) from the user.
b) Set the URL of the server (marklist.jsp) as the value of the action attribute.
c) Use submit button to invoke the server and send the form data to the server.
2. Create the JSP file with the following
a) Read the parameter value (Register Number) from the form by using the
method getParameter().
b) Server retrieves the details from the database table with respect to the form input.
c) Server displays the mark list to the client as the response.
marklist.jsp:
38
stud.HTML:
<html>
<head>
<title>Three Tier Application</title>
<style type="text/css">
body{color:blue;font-family:courier;text-align:center}
</style>
</head>
<body>
<h2>EXAMINATION RESULT</h2><hr/>
<form name="f1" method"GET" action="marklist.jsp">
Enter Your Reg.No:
<input type="text" name="regno"/><br/><br/>
<input type="submit" value="SUBMIT"/>
</form>
</body>
<html>
DATABASE
39
OUTPUT SCREENSHOTS
40
EX.NO : 7 XML SCHEMA FOR STUDENT
DETAILS DATE:
AIM:
To write a program for implementing student information using XML & XSL.
ALGORITHM:
41
//student.css
Student { background.color:#aabbcc;width:100%;} Sno {
display:block; color:GREEN; font.size:25pt; } Sname {
display:block; color:BLACK; font.size:20pt; }Dob {
display:block; color:BLUE; font.size:15pt; } Address {
display:block; color:BLUE; font.size:15pt; }m1 {
display:block; color:BLUE; font.size:15pt; }
m2 { display:block; color:BLUE; font.size:15pt; }m3
{ display:block; color:BLUE; font.size:15pt;}
//student.dtd`
<?xml version="1.0"?>
<!ELEMENT students (student+)>
<!ELEMENT student (sno,sname,dob,address,m1,m2,m3)>
<!ELEMENT sno (#PCDATA)>
<!ELEMENT sname (#PCDATA)>
<!ELEMENT dob (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT m1 (#PCDATA)>
<!ELEMENT m2 (#PCDATA)>
<!ELEMENT m3 (#PCDATA)>
OUTPUT:
RESULT: Thus the creation of XSL document using Xml has been verified successfully
42