Web Technology
Web Technology
IMPLEMENTATION OF HOTSPOTS
Mapping.html:
<html>
<head>
<title>
Mapping
</title>
<h2><Center>WEB PAGE CREATION</center></h2>
</head>
<body bgcolor="red">
<h4 align="CENTER">
IMPLEMENTATION OF HOTSPOTS
<br><br>
</h4>
<center><img src="india2.jpg" usemap="#map"/></center>
<map name="map">
<area shape="rectangle" href="Chennai.html"
coords="192,466,215,480"/>
<area shape="rectangle" href="Chennaiairport.html"
coords="182,480,208,498"/>
<area shape="rectangle" href="TajMahal.html"
coords="149,180,167,200"/>
</map>
</body>
</html>
chennai.html:
<html>
<head>
<center><h2>CHENNAI<h2></center>
</head>
<body bgcolor="sky blue">
A city of southeast India on the Coromandel Coast of the Bay of Bengal.
Founded in 1639 as Fort St. George by the British East India Company,
Chennai was held by the French from 1746 to 1749.
It is today a major industrial, commercial,
and cultural center with a thriving harbor (constructed 1862-1901).
<center><img src="chennai.jpg"></center>
</body>
</html>
chennaiairport.html:
<html>
<head>
<center><h2>CHENNAI AIRPORT</h2></center></head>
<body bgcolor="orange">
Chennai International Airport (IATA: MAA, ICAO: VOMM) is the primary
airport serving the southern Indian metropolis of Chennai.
It is located on GST road in the neighbourhood of Tirusulam in
Kanchipuram district, Tamil Nadu, within the Chennai Metropolitan Area
limits.
The IATA code MAA for the airport is derived from the former name of
Chennai, Madras.
For the year ending January 2012, it was the third busiest airport in India
in terms of both international and overall passenger traffic,which is
expected to double after December 2012 when the new terminals are
opened.
The airport is spread across the suburban areas of Meenambakkam,
Pallavaram and Tirusulam with passenger entry at Tirusulam and cargo
entry at Meenambakkam.
The domestic and the international terminals are named after former chief
ministers of Tamil Nadu, K. Kamaraj and C.N. Annadurai, respectively.
It is the first airport in India to have international and domestic terminals
adjacent to each other.
The airport is the regional headquarters of the Airports Authority of India
for the southern region of India comprising the states of Tamil Nadu,
Andhra Pradesh, Karnataka, and Kerala and the union territories of
Puducherry and Lakshadweep.
As of 2012, the annual passenger traffic at the airport is about 13 million
and the airport handles about 325 aircraft movements a day.
The passenger traffic is estimated to double by 2020 when the airport will
be capable of handling only 500 aircraft movements a day[citation
needed].
However, the airport is expected to reach saturation by 201617,
necessitating the construction of a second international airport.
In 2012, the airport was ranked 153 in the Airport Service Quality survey
(by the Airports Council International) among 156 airports in Asia.
<center><img src="chennaiairport.jpg"></center>
</body>
</html>
TajMahal.html:
<html>
<head>
<center><h2>TAJ MAHAL<h2></center>
</head>
<body bgcolor="green">
The Taj Mahal ("crown of buildings",; also "the Taj") is a mausoleum
located in Agra, India.
It is one of the most recognizable structures in the world.
It was built by Mughal emperor Shah Jahan in memory of his third wife,
Mumtaz Mahal.
<center><img src="TajMahal.jpg"></center>
</body>
</html>
OUTPUT:
Exp No:2
mainpage.html:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<title>DCE</title>
<body bgcolor="red">
<h1><center>DHANALAKSHMI COLLEGE OF
ENGINEERING</center></h1>
<br><center><a
href="mainpage.html">HOME</a>    
<a href="about.html">ABOUT US</a>    
<a href="details.html">CONTACT US</a>    
<a href="course.html">COURSES</a></center>
<center><br><b><h2>Chairman:DR.V.P.RAMAMOORTHY</h2></b><b
r>
<p>Our college offers a wide range of courses.<br>
Currently 6 UG courses and 2PG courses are offered.<p></center>
</body>
</html>
about.html:
<html>
<head>
<title>DCE</title>
<style type="text/css">
h1
{
background-color:pink;
font-family:arial;
font-size:30px;
color:violet;
}
p
{
background-color:grey;
font-family:Monotype Corsiva;
font-size:25px;
color:orange;
}
</style>
</head>
<body bgcolor="red">
<h1><center>DHANALAKSHMI COLLEGE OF
ENGINEERING</center></h1>
<a href="mainpage.html">HOME</a>
<br><p>      This institution was established
in the tear 2000.This is approved by AICTE and is affiliated to ANNA
UNIVERSITY.it is an ISO 9001:2000 certified and NBI accredited
organisation.It has an excellent infrastructure.It was found by the former
anna university professor Dr.V.P.RAMAMOORTHY.</p>
</body>
</html>
details.html:
<html>
<head>
<title>DCE</title>
</head>
<body bgcolor="red">
<ht style="font-family:arial;font-align:center;color:violet">
<center>DHANALAKSHIMI COLLEGE OF ENGINEERING</center></h1>
<a href="mainpage.html">HOME</a>
<br><h2 style="font-family:Bradley Hand ITC;fontsize:30px;color:Black;background-color:yellow">CONTACT:</h2>
<h3 style="font-family:Monotype Corsiva;fontsize:25px;color:Blue;background-color:violet">
DHANALAKSHIMI COLLEGE OF ENGINEERING,<br>
Dr.V.P.R Nagar,<br>Manimangalam,<br>Chennai-601301.<br>
PH NO:04465619401,27178355<br>www.dceeducation.com</h3>
</div>
</body>
</html>
course.html:
<html>
<head>
<link rel="stylesheet"type="text/css"href="style.css">
</head>
<title>DCE</title>
<body bgcolor="red">
<h1><center>DHANALAKSHMI COLLEGE OF
ENGINEERING</center></h1>
<br>
<a href="mainpage.html">HOME</a>
<center><h3>The course offered:</h3>
<p><br>1.Information Technology
<br>2.Electronic and Communication Engineering
<br>3.Electrical and Electronics Engineering
<br>4.Mechanical and Civil Engineering
<br>5.Computer Science and Engineering
</p></center>
</body>
</html>
style.css:
h1
{
font-family:arial;
font-size:30pt;
color:00ffff;
}
h2
{
background-color:pink;
font-family:times new roman;
font-size:20pt;
color:blue;
}
h3
{
font-family:Comic Sans MS;
background-color:pink;
font-size:15pt;
font-color:green;
}
p
{
font-family:Monotype corsiva;
background-color:grey;
font-size:15pt;
color:00f000;
}
OUTPUT:
else if(document.f1.email.value.indexOf('@gmail.com')==-1)
{
window.alert("Plz Enter Your Valid E-mail");
return false;
}
else if(document.f1.addr.value=="")
{
window.alert("Plz Enter Your Address");
return false;
}
else if(document.f1.country.selectedIndex==0)
{
window.alert("Plz Select Your Country");
return false;
}
else
if((document.f1.rdo[0].checked==false)&&(document.f1.rdo[1].checked=
=false))
{
window.alert("Plz Choose Your Gender");
return false;
}
else
if((document.f1.chk[0].checked==false)&&(document.f1.chk[1].checked=
=false))
{
window.alert("Plz Select Your Qualification");
return false;
}
else
return true;
}
</script>
</head>
<body bgcolor="lightgreen">
<h3 style="text-align:center">Web Form Validation Using Java
Script</h3>
<form name="f1" action="Register.html" onsubmit="return
validation()">
<fieldset>
<legend>Registration Form</legend>
<br/>
<table border="1">
<tr>
<td>Name:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td>Address:</td>
<td><Textarea name="addr" rows="5" cols="20"></Textarea></td>
</tr>
<tr>
<td>Country:</td>
<td>
<select name="country">
<option>---Select Your Country---</option>
<option>India</option>
<option>USA</option>
<option>AUS</option>
<option>UK</option>
</select>
</td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input type="radio" name="rdo">Male
<input type="radio" name="rdo">Female
</td>
</tr>
<tr>
<td>Qualification:</td>
<td>
<input type="checkbox" name="chk">B.E
<input type="checkbox" name="chk">M.E
</td>
</tr>
</table>
<br/>
<input type="submit" value="Register">
</fieldset>
</form>
</body>
</html>
Register.html
<html>
<head>
<title>Registration Successfull</title>
</head>
<body>
<h3>Registered Successfully.......!</h3>
</body>
</html>
4)
AIM:
To write the java program to create applets incorporating the following
features:
ALGORITHM:
1.
Import all necessary packages and classes.
2.
Define a class CPalette that extends Applet and implements
the interfaces ActionListener and ItemListener.
3.
Define the objects for the controls such as Button,
CheckboxGroup, Checkbox and TextArea.
4.
Add all the controls by using the init() method of Applet class.
5.
6.
Set the background color for each buttons by using the
method setBackground().
7.
Make the controls to listen the action by using the method
addActionListener().
8.
9.
If the item state value s=1, change the background of the
control TextArea.
10. If the item state value s=2, change the foreground of the
control TextArea.
11. Compile the java file (CPalette.java) by using the following
command line:
C:\jdk1.3.1\bin>javac CPalette.java
12.
13.
PROGRAM:
CPalette.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public
class
CPalette
extends
ActionListener,ItemListener
{
Button b1,b2,b3,b4;
CheckboxGroup cg;
Checkbox c1,c2;
TextArea ta;
int s;
public void init()
{
setLayout(null);
b1=new Button();
add(b1);
b1.setBounds(50,50,50,25);
b1.addActionListener(this);
b1.setBackground(Color.blue);
b2=new Button();
add(b2);
b2.setBounds(120,50,50,25);
b2.addActionListener(this);
b2.setBackground(Color.black);
b3=new Button();
add(b3);
b3.setBounds(50,95,50,25);
b3.addActionListener(this);
b3.setBackground(Color.red);
b4=new Button();
add(b4);
b4.setBounds(120,95,50,25);
b4.addActionListener(this);
b4.setBackground(Color.cyan);
cg=new CheckboxGroup();
c1=new Checkbox("Background",cg,false);
add(c1);
c1.setBounds(50,200,100,25);
Applet
implements
c1.addItemListener(this);
c2=new Checkbox("Foreground",cg,false);
add(c2);
c2.setBounds(50,250,100,25);
c2.addItemListener(this);
ta=new TextArea();
add(ta);
ta.setBounds(150,150,120,120);
setVisible(true);
}
public void itemStateChanged(ItemEvent ie)
{
if(c1.getState()==true)
s=1;
if(c2.getState()==true)
s=2;
}
public void actionPerformed(ActionEvent ae)
{
if(s==1)
{
if(ae.getSource()==b1)
ta.setBackground(Color.blue);
else if(ae.getSource()==b2)
ta.setBackground(Color.black);
else if(ae.getSource()==b3)
ta.setBackground(Color.red);
else
ta.setBackground(Color.cyan);
}
if(s==2)
{
if(ae.getSource()==b1)
ta.setForeground(Color.blue);
else if(ae.getSource()==b2)
ta.setForeground(Color.black);
else if(ae.getSource()==b3)
ta.setForeground(Color.red);
else
ta.setForeground(Color.cyan);
}
}
}
ColorPalette.html
<html>
<head>
<title>Color
Palette
</head>
<body
<applet
code="CPalette.class"
</applet>
</body>
</html>
Demonstration</title>
bgcolor="lightblue">
width="300"
height="400">
Get the parameter names from the HTML form by using the
method getParameterNames().
Get the parameter values from the HTML forms by using the
method getParameter().
3.
4.
5.
PROGRAM:
client.html
<html>
<head>
<title>Invoking
Servlet
From
HTML</title>
</head>
<body>
<form
name="form1"
method="post"
action="http://localhost:8080/servlets-examples/servlet/server">
<fieldset>
<legend>Login</legend>
<table>
<tr>
<td>E-mail:</td>
<td><input
type="text"
name="LoginID"
size="25"/></td>
</tr>
<td>Password:</td>
<td><input
type="password"
name="Password"
size="25"></td>
</tr>
<tr>
<td><input
type="submit"
Value="Login"></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
server.java
import java.io.*;
import java.util.*;
import javax.servlet.*;
public class server extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res)throws
ServletException,IOException
{
PrintWriter pw=res.getWriter();
pw.print("<h2>Logged in Successfully...</h2>");
pw.print("<h3><u>Login Details</u></h3>");
Enumeration e=req.getParameterNames();
while(e.hasMoreElements())
{
String str1=(String)e.nextElement();
String str2=req.getParameter(str1);
pw.print(str1+"="+str2+"<br/>");
}
pw.close();
}
}
AIM:
To write a java applet program that invokes servlet.
ALGORITHM:
1.
Write a java applet program (AppletClient.java) with the
following:
Define the objects for Button and add the button in the init()
method of Applet class.
Set the URL of the servlet program by using the object of the
class URL.
import java.io.*;
import java.net.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class AppletClient extends Applet implements ActionListener
{
{
public void service(ServletRequest req,ServletResponse res)throws
ServletException,IOException
{
PrintWriter pw=res.getWriter();
Date d=new Date();
pw.println("<h3>Current Date and Time From Server:</h3>");
pw.println("<b>"+d+"</b>");
}
}
Use submit button to invoke the server and send the form
data to the server.
2.
<p>
<a href="ExamClient.html">Back To Main Page</a>
</p>
<hr/>
<%
String str1=request.getParameter("ans1");
String str2=request.getParameter("ans2");
String str3=request.getParameter("ans3");
int mark=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:examDS");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT * FROM examTab");
int i=1;
while(rs.next())
{
if(i==1)
{
String dbans1=rs.getString(1);
if(str1.equals(dbans1))
{
mark=mark+5;
}
}
if(i==2)
{
String dbans2=rs.getString(1);
if(str2.equals(dbans2))
{
mark=mark+5;
}
}
if(i==3)
{
String dbans3=rs.getString(1);
if(str3.equals(dbans3))
{
mark=mark+5;
}
}
i++;
}
if(mark>=10)
{
out.println("<h4>Your Mark Is : "+mark+"</h4>");
out.println("<h3>Congratulations....! You Are Eligible For The Next
Round...</h3>");
}
else
{
out.println("<h4>Your Mark is : "+mark+"</h4>");
out.println("<h3>Sorry....!! You Are Not Eligible For The Next
Round...</h3>");
}
%>
</body>
</html>
Database Name: examDB.accdb
Table Name: examTab
Use submit button to invoke the server and send the form
data to the server.
2.
</form>
</body>
<html>
marklist.jsp
<%@ page contentType="text/html" language="java"
import="java.sql.*"%>
<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/>
<%
String str=request.getParameter("regno");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:markDS");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT*FROM markTab WHERE
rno="+str);
while(rs.next())
{
%>
Register No:<%=rs.getObject(1)%><br/>
Name:<%=rs.getObject(2)%><br/>
<table border="1">
<th>SUBJECT</th><th>Mark</th>
<tr><td>Artificial Intelligence</td><td><
%=rs.getObject(3)%></td></tr>
<tr><td>Object Oriented Analysis and Design</td><td><
%=rs.getObject(4)%></td></tr>
<tr><td>Advanced Computer Architecture</td><td><
%=rs.getObject(5)%></td></tr>
Associate style sheet (XSL) with XML using the markup <?
xml-stylesheet>
4.
PROGRAM:
stud.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="stud.xsl"?>
<studInfo>
<stud>
<name>Name1</name>
<dept>CSE</dept>
<rno>97709104001</rno>
</stud>
<stud>
<name>Name2</name>
<dept>CSE</dept>
<rno>97709104002</rno>
</stud>
<stud>
<name>Name3</name>
<dept>CSE</dept>
<rno>97709104003</rno>
</stud>
</studInfo>
stud.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Details - Transformation</title>
</head>
<body>
<table border="1">
<caption>Student Details</caption>
<tr>
<th>Name</th><th>Department</th><th>Register No</th>
</tr>
<xsl:for-each select="/studInfo/stud">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="dept"/></td>
<td><xsl:value-of select="rno"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:transform>
Associate style sheet (XSL) with XML using the markup <?
xml-stylesheet>
4.
PROGRAM:
rank.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rank.xsl"?>
<rankInfo>
<player>
<rank>1</rank>
<name>H.M.Amla</name>
<country>SA</country>
</player>
<player>
<rank>2</rank>
<name>A.B.De Villiers</name>
<country>SA</country>
</player>
<player>
<rank>3</rank>
<name>V.Kohli</name>
<country>IND</country>
</player>
<player>
<rank>4</rank>
<name>K.C.Sangakkara</name>
<country>SL</country>
</player>
<player>
<rank>5</rank>
<name>M.S.Dhoni</name>
<country>IND</country>
</player>
</rankInfo>
rank.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Details - Transformation</title>
</head>
<body>
<table border="1">
<caption>ICC Player Rankings</caption>
<tr>
<th>Rank</th><th>Name</th><th>Country</th>
</tr>
<xsl:for-each select="/rankInfo/player">
<tr>
<td><xsl:value-of select="rank"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="country"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:transform>
following.
AJAX send the request with the use of send() and open()
methods.
if(window.ActiveXObject)
{
req=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
req=new XMLHttpRequest();
}
req.onreadystatechange=diplayProfile;
req.open('POST',url,true);
req.send(null);
}
function diplayProfile()
{
if(req.readyState==4) {
document.getElementById('contentArea').innerHTML=req.responseText;
}
function clearContent()
{
document.getElementById('contentArea').innerHTML='';
}
</script>
</head>
<body bgcolor="cyan">
<h1>Mouse over the image for More Information</h1>
<img src="sachin.jpg" height="95" width="80"
onmouseover='getContent("sachin.html")'
onmouseout='clearContent()'/>
<img src="dravid.jpg" height="95" width="80"
onmouseover='getContent("dravid.html")'
onmouseout='clearContent()'/>
<img src="kohli.jpg" height="95" width="80"
onmouseover='getContent("kohli.html")' onmouseout='clearContent()'/>
<img src="raina.jpg" height="95" width="80"
onmouseover='getContent("raina.html")' onmouseout='clearContent()'/>
<img src="yuvi.jpg" height="95" width="80"
onmouseover='getContent("yuvi.html")' onmouseout='clearContent()'/>
kohli.html
<html>
<body>
<b>Full name:</b> Virat Kohli<br/><br/>
<b>Born:</b>November 5, 1988, Delhi<br/><br/>
<b>Major teams:</b>India, Delhi, India Red, India Under-19s, Royal
Challengers Bangalore<br/><br/>
<b>Playing role:</b>Middle-order batsman<br/><br/>
<b>Batting style:</b>Right-hand bat<br/><br/>
<b>Bowling style:</b>Right-arm medium
</body>
</html>
raina.html
<html>
<body>
<b>Full name:</b> Suresh Kumar Raina<br/><br/>
<b>Born:</b>November 27, 1986, Muradnagar, Ghaziabad, Uttar
Pradesh<br/><br/>
<b>Major teams:</b>India, Chennai Super Kings, India Blue, India
Under-19s, Indian Board President's XI, Rajasthan Cricket Association
President's XI, Uttar Pradesh, Uttar Pradesh Under-16s<br/><br/>
<b>Playing role:</b>Middle-order batsman<br/><br/>
<b>Batting style:</b>Left-hand bat<br/><br/>
<b>Bowling style:</b> Right-arm offbreak
</body>
</html>
yuvi.html
<html>
<body>
<b>Full name:</b>Yuvraj Singh<br/><br/>
<b>Born:</b>December 12, 1981, Chandigarh<br/><br/>
<b>Major teams:</b>India, Asia XI, Kings XI Punjab, Pune Warriors,
Punjab, Yorkshire<br/><br/>
<b>Playing role:</b>Middle-order batsman<br/><br/>