Web Technology Lab
Web Technology Lab
Date:
AIM:
To Create a web page using HTML to insert a image map, fix the hotspots on it and show the
information about it in a web page.
ALGORITHM:
Home.html
PROGRAM:
HOME.html
<html>
<head>
</head>
<body bgcolor="gold">
<h1><u><center>Republic of India</center></u></h1>
<p>
India is the Seventh Lagest country in the world by geographical area, the second
most populous country with over 1.2 billion people, and the populus democracy in the
</p>
<center>
<map name="india">
</map>
</center>
<h2> Features</h2>
<ul>
</li>
</ul>
<h2>
<b>To view details of states please click on the specified area in the
map !!!</b>
</h2>
</body>
</html>
ANDHRAPADESH.html
<html>
<body bgcolor="tan">
<h1><center>Andhra Pradesh</center></h1>
<h3>
<ul>
<li>Districts<i> - 23</i>
<li>Governor<i> - BiswabhusanHarichandan</i>
<li>Population<i> - 78,323,330</i>
</ul>
<a href="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>Population<i> - 33,387,677</i>
Alapuzha etc.,</i>
</ul>
</h3>
<a href="Home.html">Back</a>
</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>Population<i> - 61,130,704</i>
</ul>
</h3>
<a href="Home.html">back</a>
</body>
</html>
TAMILNADU.html
<html>
<body bgcolor="palegreen">
<h1><center>Tamil Nadu</center></h1>
<h3>is one of the 28 states of India. Its capital and largest city is Chennai.
Tamil Nadu lies in the southernmost part of the Indian Peninsula and
</h3>
<h3>
<ul>
<li>Districts<i> - 32</i>
<li>Population<i> - 72,138,958</i>
</ul>
<a href="Home.html">back</a>
</body>
</html>
OUTPUT:
RESULT:
Thus the web page is created and the image is embedded with hot spot and the linking
successfully and the output is verified.
Ex:02 Creating Website using CSS
Date:
Aim
To create a web site for our college using HTML and CSS.
Program
Step 4:Link your CSS files to your HTML document using the <link> element.
Step 5:Create a user interface element (e.g., a button) to trigger the style switch.
Step 6:Write a JavaScript function to toggle between different stylesheets by changing the
href attribute of the linked CSS file.
Step 7:Test and deploy your HTML document with the style-switching mechanism.
Step 8:Optionally, enhance the mechanism with features like user preference storage or more
stylesheets.
Ex2.html
<html>
<head>
<title>A.V.C.C.E.</title>
<style type="text/css">
p{
background-color: lightgrey;
text-align: justify;
</style>
</head>
<body id="body">
<p>
A.V.C. College of Engineering was started in the year 1996 committed to social welfare. The founding
father Sri S. Ramalingam Pillai sowed the seeds of A.V. Charities in 1806 in memory of his beloved
son Thiru Velayutham pillai. A.V. Charities began its educational services by starting the A.V.C.
(Autonomous) college in 1955, extended their horizon to A.V.C Polytechnic in 1983 and in 1996 by
opening the Engineering college. A.V. Charities serve as Beacon light in the field of education to the
innumerable youth, with rural background. We are very glad to say that we are second to none in
enhancing the young minds to compete the ever changing global changes.
A.V.C. College of Engineering is a pioneer institution and first self financing college in Nagapattinam
District. We have been approved by All India Council for Technical Education (AICTE) and also in
possession of ISO 9001:2015 certificate. We are moving ahead with National Board of Accreditation
(NBA) for the Engineering courses. Our Mission is to make the institution a Centre of Academic
Excellence. The R&D facilities have been opened up to make the students as reservoir of knowledge,
aptitude to advance and to face the global challenges.
</p>
<tr>
<td align="left">
<div class="div">
<ul>
<lh>DEPARTMENTS</lh>
<li><a href="cse.html">CSE</a></li>
<li><a href="ece.html">ECE</a></li>
</ul>
</div>
</td>
</tr>
</table>
</body>
</html>
Cse.html
<html>
<head>
<title>CSE</title>
</head>
<body>
<h3> <b>VISION</b></h3>
<p>To excel in the field of Computer Science and Engineering with technological
innovations.</p>
<h3><b>MISSION</b></h3>
<p> 1. To impart quality technical education to the students through creative teaching learning
process.<br>
2.To create facilities and expertise in cutting-edge computer technologies through Industry
Institute partnership.<br>
3. To motivate the students to apply their innovative ideas to construct research models.<br>
</div>
</body>
</html>
Ece.html
<html>
<head>
<title>CSE</title>
</head>
<body>
<h3><b>VISION</b></h3>
</P>
<h3><b>MISSION</b></h3>
<P><ol type="1">
<li>To contribute knowledge in fundamentals and applied areas of Electronics and Communication
Engineering</li>
<li>To carry out project works through constant interaction with industry</li>
<li>To provide ethical and value based education to serve societal needs</li>
</ol></P>
</div>
</body>
</html>
Result:
Thus the HTML program for creating websites using different style sheets was executed
successfully.
Ex:03 Validating Web Form Controls using DHTML
Date:
Aim
To write a DHTML program to validate web form controls for Client side
script.
Algorithm:
Step 1: Write a Html program for accepting basic information like Name,Password etc.,
Step 2:Now write a javascript program to get these information and do some basic evaluation
like name not null,password confirmation.,
Step 3:Pass the values to the JavaScript and evaluate the information
Step 4:Add CSS to style the webpage and use alert to show the error.
Program:
Userlogin.html
<html>
<head>
<SCRIPT LANGUAGE="JAVASCRIPT">
function essentials_of_validation(form1)
var return_value=true;
var username=form1.txtusername.value;
var password1=form1.txtpassword1.value;
var password2=form1.txtpassword2.value;
if(username.length < 8)
return_value=false;
}
if(password1.length<6)
return_value=false;
form1.txtpassword1.value="";
form1.txtpassword2.value="";
if(password1!=password2)
return_value=false;
form1.txtpassword1.value="";
form1.txtpassword2.value="";
return return_value;
</script>
</head>
<body bgcolor="skyblue">
here</font></u></b></marquee>
<br><br>
</form>
</body>
</html>
Output:
Result:
Thus the HTML program for evaluating the web form controls was executed successfully.
Ex:04 Installing Apache Tomcat in Windows
Date:
Step 1: We need to first install the Tomcat 10 zip file from this website. On the website,
select the 64-bit Windows zip (PGP, sha512) in the Core section to start the download
process for the Tomcat zip file.
Step 2: Check If JDK Is Installed. Open Command Prompt and enter the following
commands
$ java -version
$ javac –version
If JDK is not installed on your computer, install JDK. In the above picture, we can see JDK is
already installed on our computer.
Step 3: Unzip Tomcat 10 Zip File. Go to the location where you have downloaded the
Tomcat 10 zip file. Right-click on the Apache tomcat file place the cursor on 7-Zip and click
on Extract Here to extract the folder.
Step 4: Creating JAVA_HOME Variable. Click Start then in the search bar, search for “Edit
the system environment variables” and click on it. The following System Properties box will
open. Select Environment Variables in the box.
On clicking Environment Variables the following box will open.
Step 5: We have to create a JAVA_HOME variable and insert the path of the JDK file stored
in our computer, which will be shown below. So select New from the System variables in the
above picture. A New System Variable box will be opened where we will have to fill in the
Variable name and Variable value.
Step 6: Go to the location where you have stored the contents of the JDK file in My
Computer or PC. Copy the root path of the location of the JDK file as shown below.
Step 7: Paste the JDK path from the above picture into the Variable value field and in the
Variable name field, give the name JAVA_HOME as shown below.
Step 8: Check the Working of Tomcat. Open the extracted apache tomcat file. We will see
all the following files in them. Among them open the batch file named “startup”.
Step 10: Successful Installation of Tomcat. Our next step is to open an internet browser like
Google and type in the address
http://localhost:8080
Then click enter and the following browser will appear suggesting the successful installation
of Apache Tomcat.
Result:
Thus the Apache Tomcat server was installed successfully.
Ex:05(A) Invoking Servlets from HTML forms
Date:
Aim:
Procedure:
index.html:
(1) Create a web page using HTML form that contains the fields such as
label,text and one submit button.
(2) Set the URL of the server as the value of form’s action attribute.
welcome.java:
(1) Define the class server that extends the property of the class
GenericServlet.
(2) Handle the request from the client by using the method service() of
GenericServlet class.
(3) Get the parameter names from the HTML form by using the method
getParameterNames().
(4) Get the parameter values from the HTML forms by using the method
getParameter().
(5) Send the response to the client by using the method of PrintWriter class
Program:
Index.html
<html>
<head>
</head>
<body>
</form>
</body>
</html>
Welcome.java
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
response.setContentType("text/html;charset=UTF-8");
String username=request.getParameter("uname");
out.println("Welcome "+username);
} }
}
OUTPUT:
Result:
Thus, the invocation of servlet from HTML from has been developed successfully
Ex:5(B) Session Tracking
Date:
Aim:
Procedure:
4. The second servlet will display the user information with greeting message.
Program:
Index.html
<html>
<head>
</head>
<body>
<form action="ser1">
</form>
</body>
</html>
Ser1.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
response.setContentType("text/html;charset=UTF-8");
String n=request.getParameter("uname");
String c=request.getParameter("city");
out.println("<form action=serv2>");
serv2.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
response.setContentType("text/html;charset=UTF-8");
String n=request.getParameter("uname");
String c=request.getParameter("city");
out.println("Hello "+n+"<br>");
Output
Result:
Thus, the Java Program for Session Tracking Using Hidden Form Fields has been executed
successfully.
Ex:06 Conducting Online Examination Using JSP
Date:
Aim:
To create the JSP program for conducting online examination for displaying mark list.
Algorithm:
Program:
Newjsp.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Examination Panel</title>
</head>
<body bgcolor="cyan">
<%@ page language="java" %>
<%@ page import ="java.sql.*" %>
<%
String reg= request.getParameter("txt_reg");
String name = request.getParameter("txt_name");
out.println("<h2>Welcome" + name + "...Your Register number is " + reg +
"!!</h2><br><br><br>");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sTable = "exam";
String sSql = "SELECT * FROM " + sTable + "";
String database = "jdbc:odbc:sDBQ";
Connection cn = null;
Statement st = null;
ResultSet rs = null;
try {
cn = DriverManager.getConnection( database ,"sa","");
st = cn.createStatement();
rs = st.executeQuery( sSql );
ResultSetMetaData rsmd = rs.getMetaData();
String s1,s2,s3,s4;
int i=1;
while(rs.next())
{
out.println("<form name='exam' action='newjsp2.jsp' method='post'><b>"+i+"
."+
rs.getString(1) + "</b><br><br>");
s1 = rs.getString(2);
s2 = rs.getString(3);
s3 = rs.getString(4);
s4 = rs.getString(5);
out.println("<input type=radio name=opt"+i+" value="+s1+" CHECKED>"+
s1 +" <br><br>");
out.println("<input type=radio name=opt"+i+" value="+s2+">" + s2
+"<br><br>");
out.println("<input type=radio name=opt"+i+" value="+s3+">" + s3
+"<br><br>");
out.println("<input type=radio name=opt"+i+" value="+s4+">" + s4
+"<br><br>");
i++;
}
out.println("<input name ='submit' value='Submit' type='submit'/>");
/*int n = rsmd.getColumnCount();
out.println( "<table border=1 cellspacing=3><tr>" );
for( int i=1; i<=n; i++ ) // Achtung: erste Spalte mit 1 statt 0
out.println( "<th>" + rsmd.getColumnName( i ) + "</th>" );
while( rs.next() )
{out.println( "</tr><tr>" );
for( int i=1; i<=n; i++ ) // Achtung: erste Spalte mit 1 statt 0
o ut.println( "<td nowrap>" + rs.getString( i ) + "</td>" );
}
out.println( "</tr></table>" );*/
}finally {
try { if( null != rs ) rs.close(); } catch( Exception ex ) {}
try { if( null != st ) st.close(); } catch( Exception ex ) {}
try { if( null != cn ) cn.close(); } catch( Exception ex ) {}
}
%>
</body>
</html>
Newjsp1.jsp
Newjsp2.jsp
<%@page import="com.sun.java.swing.plaf.windows.resources.windows_es"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Exam Report</title>
</head>
<body bgcolor="cyan">
<center><h1>Your Report Card</h1></center>
<%@ page language="java" %>
<%@ page import ="java.sql.*" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sTable = "exam";
String sSql = "SELECT * FROM " + sTable + "";
String database = "jdbc:odbc:sDBQ";
Connection cn = null;
Statement st = null;
ResultSet rs = null;
try {
cn = DriverManager.getConnection( database ,"sa","");
st = cn.createStatement();
rs = st.executeQuery( sSql );
ResultSetMetaData rsmd = rs.getMetaData();
String s1,s2,s3,s4;
int i=1;
int correct=0,incorrect=0,total=0;
out.println("<h2><br><br><center><table border=1 cellpadding=2
cellspacing=2><tr><th>Question</th><th>Your Answer</th><th>Correct
Answer</th><th>Status</th></tr>");
while(rs.next())
{
total++;
s1 = rs.getString(1);
s2 = request.getParameter("opt"+i);
s3 = rs.getString(6);
if(s2.equals(s3))
{ s4="Correct";
correct++;
}
else
{ s4="Incorrect";
incorrect++;
}
out.println("<tr><td>"+s1+"</td><td>"+s2+"</td><td>"+s3+"</
td><td>"+s4+"</td></tr>");
i++;
}
out.println("</table><br><br><table><b><tr><td>Correct
Answers</td><td>"+correct+"</td></tr>");
out.println("<tr><td>Incorrect Answers</td><td>"+incorrect+"</td></tr>");
out.println("<tr><td>Total
Questions</td><td>"+total+"</td></tr></table></b></center></h2>");
}
finally {
try { if( null != rs ) rs.close(); }
catch( Exception ex ) {}
try { if( null != st ) st.close(); }
catch( Exception ex ) {}
try { if( null != cn ) cn.close(); }
catch( Exception ex ) {}
}
%>
</body>
</html>
Output:
Result:
Thus the JSP program for online examination was executed by connecting the
SQLSERVER and result was verified.
Ex:07(A) XML Schema and Referencing
Date:
Aim:
Algorithm:
Program:
Schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="library">
<xs:complexType> <xs:sequence>
<xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XML:
<library>
<book>
<author>J.D. Salinger</author>
<publication_year>1951</publication_year>
</book>
<book>
<author>Harper Lee</author>
<publication_year>1960</publication_year>
</book>
<book>
<title>1984</title>
<author>George Orwell</author>
<publication_year>1949</publication_year>
</book>
</library>
Output:
Result:
Thus the XML schema was created and referred in an external xml document.
Ex:07(B) Online Application for Students using XML and XSL
Date:
Aim:
To develop an Online Applications for displaying student’s mark list using XML AND XSL.
Algorithm:
Step 3: Create an xsl for getting the marks from the xml.
Step 5: The student’s mark list for the corresponding register number will be displayed.
Stud.xml
<class>
<name>Ram</name>
<marks>85</marks>
</student>
<name>Madhu</name>
<marks>95</marks>
</student>
<name>Arun</name>
<marks>90</marks>
</student>
<student rollno = "104">
<name>Kumar</name>
<marks>75</marks>
</student>
<name>Vinoth</name>
<marks>50</marks>
</student>
<name>Jenni</name>
<marks>98</marks>
</student>
<name>Priya</name>
<marks>95</marks>
</student>
<name>Parkshidha</name>
<marks>100</marks>
</student>
<name>Sreeji</name>
<marks>80</marks>
</student>
<name>Latha</name>
<marks>93</marks>
</student>
</class>
students.xsl
<html>
<body>
<h2>Students</h2>
<th>Roll No</th>
<th>Name</th>
<th>Marks</th>
</tr>
<xsl:for-each select="class/student">
<tr>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Output:
RESULT:
Thus the application to get the marks of the students using xml and xsl was successfully executed.