Gitam WT Lab Manual
Gitam WT Lab Manual
Week1:
Aim: A static homepage must contain 3
frames.
Top frame: Home, Login, Registration,
Catalogue and Cart page
Left frame: At least 4 links for navigation
Right frame: All pages to the links should load
here.
Sourecode: <-- Top.html >
<html>
<head>
</head>
<body>
<table height="252"
width="1256" border="1">
<tr>
<td align="center"><img
src="image.jpg" height="70"
width="70" ></td>
<th
colspan="4"><H1><B><I>ONLINE
BOOK STORE</I></B></H1></th>
</tr>
<tr>
<th><a href="home.html"
target="id3">Home</a></th>
<th><a href="login.html"
target="id3">Login</a></th>
<th><a href="registration.html"
target="id3">Registration</a></th> <th><a
href="catologue.html"
target="id3">Catologue</a></th> <th><a
href="cart.html" target="id3">Cart</a></th>
</tr>
</table>
</body>
Department of CSE,GST Page 3
WEB TECHNOLOGY LAB
</html>
< -- Left.html -->
<html>
<body>
<a href="cse.html"
target="id3">CSE</a><br> <a
href="ece.html" target="id3">ECE</a><br>
<a href="eee.html"
target="id3">EEE</a><br> <a
href="civil.html" target="id3">CIVIL</a>
</body>
</html>
<frameset cols="20%,60%">
<frame src="left.html" name="id2" />
<frame src="right.html" name="id3" />
</frameset>
</head>
</html>
Aim: To create
contains LOGIN HTML page this
details.
Source code:
< -- LOGIN.html -- >
<html>
<body>
<table
align="ce
nter">
<form
action=su
ccess.htm
l>
<tr><td>
Username
:</td>
<td><input
type="text"
/></td>
</tr>
<tr><td>Password:</td>
<td><input
type="passw
ord"/></td>
</tr>
Department of CSE,GST Page 10
WEB TECHNOLOGY LAB
<tr><td><input
type="submit"
value=signin />
<input
type="reset"
value=clear />
</td>
</tr>
</form>
</table>
</body>
</html>
Output:
Homepage.html/Login
Week -1B
Aim: To create CATOLOGUE page
that should contain following fields.
1. Snap shot of cover page
2. Author Name
3. Publisher
4. Price
5. Add to cart button
Source code:
< -- Catologue.html -- >
<html>
<body>
<p align="center">COMPUTER
SCIENCE ENGINEERING</p>
<tr><td><img src="1.jpg"
height="50" width="50" alt="search
image"/></td>
<td>Book: XML Bible<br>
Author: Winston<br>
Publication: Wiely
</td>
<td>$40.5</td>
<td><input type="button"
value="Add to cart"/></td>
</tr>
<tr><td><img src="2.jpg"
height="50" width="50" alt="search
image"/></td>
<td>Book: AI<br>
Author: S.Russel<br>
Publication: Princeton hall
</td>
Department of CSE,GST Page 14
WEB TECHNOLOGY LAB
<td>$63</td>
<td><input type="button"
value="Add to cart"/></td>
</tr>
<tr><td><img src="3.jpg"
height="50" width="50"
alt="search image"/></td>
Author: Watson<br>
Publication: BPB publications
</td>
<td>$
35.5</
td>
<td><input
type="button"
value="Add to
cart"/></td> </tr>
</table>
<p align="center">ELECTRICAL
AND ELECTRONICS
ENGINEERING</p>
<tr><td><img src="7.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book: EDC<br>
Author: Winston<br>
Publication: Wiely
</td>
<td>$
40.5</
td>
<td><input
type="button"
Department of CSE,GST Page 17
WEB TECHNOLOGY LAB
value="Add to
cart"/></td> </tr>
<tr><td><img src="5.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book: SATELLITE
COMMUNICATION<br>
Author: SAT<br>
Publication: Princeton hall
</td>
<td>
$63</
td>
<td><input type="button"
value="Add to cart"/></td>
</tr>
<tr><td><img src="6.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book:
ANTENNAS<br>
Author: Watson<br>
Publication: BPB publications
</td>
<td>$
35.5</
td>
<td><input
type="button"
value="Add to
cart"/></td> </tr>
</table>
<p align="center">CIVIL
ENGINEERING</p>
height="50" width="50"
alt="search image"/></td>
<td>Book: FEDERALS OF
Author: Winston<br>
Publication: Wiely
</td>
<td>$
40.5</
td>
Department of CSE,GST Page 21
WEB TECHNOLOGY LAB
<td><input
type="button"
value="Add to
cart"/></td> </tr>
<tr><td><img src="12.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book: CIVIL
PROCEDURE<br>
Author:
S.Russel<
br>
Publicatio
n:
Princeton
hall
</td>
<td>$
63</td
>
<td><input
type="button"
value="Add to
cart"/></td> </tr>
<tr><td><img src="13.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book:BULIDING
MATERIALS<br>
Author:
Watson<br>
Publication:
BPB
publications
</td>
<td>$
35.5</
td>
<td><input
type="button"
value="Add to
cart"/></td> </tr>
</table>
<p
align="center">ELECTRONI
CS AND
COMMUNICATION
ENGINEERING</p> <table
align="center" height="100"
width="500" border="5">
<tr><td><img src="3.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book: java2<br>
Author: Winston<br>
Publication: Wiely
</td>
<td>$
40.5</
td>
<td><input
type="button"
value="Add to
cart"/></td> </tr>
<tr><td><img src="4.jpg"
height="50" width="50"
Department of CSE,GST Page 27
WEB TECHNOLOGY LAB
alt="search image"/></td>
<td>Book: SATELLITE
COMMUNICATIONS
<br>
Author:
S.Russel<
br>
Publicatio
n:
Princeton
hall
</td>
<td>
$63</
td>
<td><input type="button"
value="Add to cart"/></td>
</tr>
<tr><td><img src="5.jpg"
height="50" width="50"
alt="search image"/></td>
<td>Book: TELEPHONIC
COMMUNICATION<br>
Author: Watson<br>
Publication: BPB publications
</td>
<td>$
35.5</
td>
<td><input
type="button"
value="Add to
cart"/></td> </tr>
</table>
</body>
</html>
Department of CSE,GST Page 30
WEB TECHNOLOGY LAB
Output:
Homepage.html/Catalogue
Week2
Aim: To create a Cart page that
contains Detains about the books
which are added to the Cart.
Source code:
< -- Cart.html -->
<html>
<body><table>
<tr>
<th><h4>BOO
NAME</h4></t
h>
<TD><th><h4>
Department of CSE,GST Page 33
WEB TECHNOLOGY LAB
PRICE</h4></t
h></TD>
<TD><th><h4>
QUANTITY</h
4></th></TD>
<TD><th><h4>
AMOUNT</h4
></th></TD>
</tr>
<tr>
<th><h5>JAV
A2</h5></th
>
<TD><th><h
5>$35.5</h5>
</th></TD>
<TD><th><h
5>2</h5></th
></TD>
<TD><th><h
5>$70</h5><
/th></TD>
</tr>
<tr>
<th><h5>XM
BIBLE</h5>
</th>
<TD><th><h
5>$40.5</h5>
</th></TD>
<TD><th><h
5>1</h5></th
></TD>
<TD><th><h
5>$40.5</h5>
</th></TD>
</tr>
</table></body>
</html>
Output:
Cart.html
Week-2B
Aim: To create a “Registration form
“which contains 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)
Source code:
< -- Registration.html-- >
<html>
<body>
<form
action=su
ccess.htm
l>
<table>
<tr><td>
Name:</t
d>
<td><input
type="text"
/></td>
</tr>
<tr><td>Password:</td>
<td><input
type="passw
ord"/></td>
</tr>
<tr><td>E
MAIL-
ID:</td>
<td><input
type="text"
/></td>
</tr>
<tr><td>PH
ONE
NUMBER:
</td>
<td><input
type="text"/
></td>
</tr>
<tr><td>SEX:</td>
<td><input type="radio"/
name="radiobutton"VALUE="male"
>M
<input type="radio"/
name="radiobutton"
VALUE="female">F</td>
</tr>
<tr><td>DOB:</td>
<td>
<select>
<option>DAY</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<select>
Department of CSE,GST Page 42
WEB TECHNOLOGY LAB
<option>MONTH</option>
<option>JAN</option>
<option>FEB</option>
<option>MAR</option>
<option>APR</option>
</select>
<select>
<option>YEAR</option>
<option>1991</option>
<option>1990</option>
<option>1989</option>
<option>1988</option>
</select></td>
</tr>
<tr><td>LANGUAGES
KNOWN:</td>
<td><input
type="checkb
ox"/>english
<input
type="checkb
ox"/>telugu
<input
type="checkb
ox"/>hindi
<input type="checkbox"/>tamil
</td>
</tr>
<tr><td>Address:</td>
<td><textarea
rows=5></text
area></td>
</tr>
<tr><td><input
type="submit"
Department of CSE,GST Page 44
WEB TECHNOLOGY LAB
value="submit"/
> <input
type="reset"
value="reset"/>
</td>
</tr>
</table>
</form>
</body>
</html>
Output:
Registration.html
Week-3
Aim: Write JavaScript to validate the
following fields in 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
standarn pattern [email protected])
4. Phone Number (Phone number
should contain 10 digits only)
And use PHP to connect with the
database to store the above details.
Source code:
<--
Registra
Department of CSE,GST Page 48
WEB TECHNOLOGY LAB
tion.htm
l>
<html>
<head>
<title>JavaScript Form
registration form</title>
<link rel='stylesheet'
href='js-form-validation.css'
src="sample-registration-
form-
validation.js"></script>
</head>
<body
onload="document.registration.userid.f
ocus();"> <h1>Registration
Form</h1>
method="post" onSubmit="return
formValidation();"
action="data1.php"> <ul>
<li><label
for="userid">User
id:</label></li>
<li><input
type="text"
name="userid"
size="12" /></li>
<li><label
for="passid">Passwo
rd:</label></li>
<li><input
type="password"
name="passid"
size="12" /></li>
<li><label
for="username">Name:
</label></li>
<li><input type="text"
name="username"
size="50" /></li>
<li><label
for="address">Addres
s:</label></li>
<li><input type="text"
name="address"
size="50" /></li>
<li><label
for="country">Countr
y:</label></li>
<li><select name="country">
<option selected=""
value="Default">(Please
select a country)</option>
<option
value="Australia">Australia
</option>
<option
value="canada">
Canada</option>
<option
value="india">In
dia</option>
<option
value="russia">R
ussia</option>
<option
value="usa">US
A</option>
</select></li>
<li><label
for="zip">ZIP
Code:</label></li>
<li><input
type="text"
name="zip"
/></li> <li><label
for="email">Email
:</label></li>
<li><input type="text"
name="email"
size="50" /></li>
<li><label
id="gender">Sex:</lab
el></li>
<li><input type="radio"
name="sex" value="Male"
/><span>Male</span></li>
<li><input type="radio"
name="sex" value="Female"
/><span>Female</span></li>
<li><label>Language:</label></
li>
<li><input type="checkbox"
name="en" value="english"
checked /><span>English</span></li>
<li><input type="checkbox"
name="nonen" value="non-english"
/><span>Non English</span></li>
<li><label
for="desc">About:</label></li>
<li><textarea
name="desc"
id="desc"></textarea></li
> <li><input
type="submit"
name="submit"
value="Submit" /></li>
</ul>
</form>
</body>
</html>
< sample-registration-form-
validation.js>
function formValidation()
{
var uid = document.registration.userid;
var passid =
document.registration.passid;
var uname =
document.registration.userna
me; var uadd =
document.registration.addres
s; var ucountry =
document.registration.countr
y; var uzip =
document.registration.zip;
var uemail =
document.registra
tion.email; var
umsex =
document.registra
tion.msex; var
ufsex =
Department of CSE,GST Page 61
WEB TECHNOLOGY LAB
document.registra
tion.fsex;
if(userid_validati
on(uid,5,12))
{
if(passid_validation(passid,7,12))
{
if(allLetter(uname))
{
if(alphanumeric(uadd))
{
if(countryselect(ucountry))
{
if(allnumeric(uzip))
{
if(ValidateEmail(uemail))
{
if(validsex(umsex,ufsex))
{
}
}
}
}
}
}
}
}
return false;
}
function
userid_validation(uid,mx,my)
{
var uid_len = uid.value.length;
if (uid_len == 0 || uid_len >= my ||
uid_len < mx)
{
alert("User Id should not be
empty / length be between
"+mx+" to "+my); uid.focus();
return false;
}
return true;
}
function
passid_validation(passid,mx,my)
{
var passid_len = passid.value.length;
match(letters)
)
{
return true;
}
else
{
alert('User address must
have alphanumeric
characters only');
uadd.focus();
return false;
}
}
function countryselect(ucountry)
{
if(ucountry.value == "Default")
{
alert('Select your
country from the
list');
ucountry.focus();
return false;
}
else
{
return true;
}
}
function allnumeric(uzip)
{
var numbers
= /^[0-9]+$/;
if(uzip.value.
match(numbe
rs))
{
return true;
}
else
{
alert('ZIP code must
have numeric characters
only'); uzip.focus();
return false;
}
}
function ValidateEmail(uemail)
{
var mailformat = /^\w+
([\.-]?\w+)*@\w+
([\.-]?\w+)*(\.\w{2,3})+$/;
if(uemail.value.match(mail
format))
{
return true;
}
else
{
alert('Select
Male/Female');
umsex.focus();
return false;
}
else
{
alert('Form Succesfully Submitted');
window.locatio
n.reload()
return true;
}
}
$passid1=$_POST
['passid'];
$username1=$_P
OST['username'];
$address1=$_POS
T['address'];
$country1=$_POS
T['country'];
$zip1=$_POST['zi
p'];
$email1=$_POST[
'email'];
$gender=$_POST[
'sex'];
$en1=$_POST['en
'];
$nonen1=$_POST
['nonen'];
$desc1=$_POST['
desc'];
if($en1=="english"&&$nonen1=="n
on-english")
{
$checkbox1=$en1+"and"+$nonen1;
}
else if($en1=="english")
{
$checkbox1=$en1;
}
else if($nonen1=="non-english")
{
$checkbox1=$nonen1;
}
$con=mysql_connect(
"127.0.0.1","root","");
if($con)
{
print "<br>"."connected to mysql";
Department of CSE,GST Page 72
WEB TECHNOLOGY LAB
}
$db_con=mysql_select_db("validdata
base",$con);
if($db_con)
{
print "<br>"."connected to database";
print "<br>";
print "<br>"."---------------database
data--------------"."<br>";
$sql="INSERT INTO
`validdatabase`.`data_validation` (
`userid` ,`password` , `name` ,
`address` , `country` , `zipcode` ,
`email` , `sex` , `language` , `about`
)
VALUES('$userid1','$passid1','$user
name1','$address1','$country1','$zip1'
,'$email1','$gender','$checkbox1','$de
sc1' )";
$result=mysql_query($sql);
Department of CSE,GST Page 73
WEB TECHNOLOGY LAB
$sql1="SELECT *
FROM
`data_validation`";
$result1=mysql_query($
sql1);
while($data=mysql_fetch_assoc($res
ult1))
{
print "<br>";
print
$data['userid']."<br>";
print
$data['password']."<br
>"; print
$data['name']."<br>";
print
$data['address']."<br>"
; print
Department of CSE,GST Page 74
WEB TECHNOLOGY LAB
$data['country']."<br>"
; print
$data['zipcode']."<br>"
; print
$data['email']."<br>";
print
$data['sex']."<br>";
print
$data['language']."<br
>"; print
$data['about']."<br>";
print "<br>";
}
}
?>
</body>
</html>
< -- js-form-validation.css -->
Department of CSE,GST Page 75
WEB TECHNOLOGY LAB
h1 {
margin-left: 70px;
}
f
o
r
m
li
{
li
st
-
st
y
l
e
:
n
o
Department of CSE,GST Page 76
WEB TECHNOLOGY LAB
n
e
;
margin-bottom: 5px;
form
ul li
label
{ floa
t:
left;
clear:
left;
width
:
100p
x;
text-
align:
right;
Department of CSE,GST Page 77
WEB TECHNOLOGY LAB
margin-right: 10px;
font-
family:Verdana,
Arial, Helvetica,
sans-serif; font-
size:14px;
}
form ul li
input,
select,
span
{ float:
left;
margin-bottom: 10px;
}
form
texta
rea {
float:
Department of CSE,GST Page 78
WEB TECHNOLOGY LAB
left;
widt
h:
350p
x;
heig
ht:
150p
x;
}
[type
="sub
mit"]
{ clea
r: left;
margin:
20px 0 0
230px;
font-
Department of CSE,GST Page 79
WEB TECHNOLOGY LAB
size:18p
x
}
p{
margi
n-left:
70px;
font-
weigh
t:
bold;
}
Database image:
Table image :
Registration.html
Userid validation:
Password validation:
Name validation:
Email id validation:
Database data:
Week-4
AIM:To implement:
a)Inline style sheet b)Embedded
style sheet c)External style sheet
To implement Inline style sheet
PR
OG
RA
M:
<ht
ml>
<hea
d>
<titl
e>
inline
style
sheet
</titl
e>
</head>
<body>
<p
style="fo
nt-
size:20pt
"> this is
an
example
</p>
<p
style="font-
size:30pt;col
or:red"> this
is second p
tag
</p>
</body>
</html>
OUTPUT:
color:yellow}
p{font-size:15pt}
p.blue{c
olor:blu
e}
h1.obj{f
ont-
style:ita
lic}
</style>
</head>
<body>
<h1 class=obj>
this is
example
of h1
Department of CSE,GST Page 94
WEB TECHNOLOGY LAB
tag
</h1>
<p>
this
is p
tag
</p
>
<h1>
this is
second
h1 tag
</h1>
<p class=blue>
this is
demo for
Department of CSE,GST Page 95
WEB TECHNOLOGY LAB
p
element
</p>
</body>
</html>
OUTPUT:
lor:red;background-
color:blue} h1
em{color:red}
li
em{color:yellow;bac
kground-
color:red;font-
weight:bold} ul
{margin-
left:2cm;color:red}
ul ul{text-
decoration:underline;margin-
left:1.5cm;color:yellow}
HTML file:
<html>
<head>
<title>external</tilte>
<link
type="text/css"
rel="stylesheet"
href="file.css">
</head>
<h1>courses
offered in
<em>DRKIST</e
m></h1> <ul>
<li>
mca</li>
<li>
b-
tech
<ul
>
<li>
cse
</li
>
<li>
ece
</li
>
<li>
eee
Department of CSE,GST Page 102
WEB TECHNOLOGY LAB
</li
>
</ul
>
</li>
<li>
mba<
/li>
<li>
m-
tech<
/li>
<li>m-
tech<em>:specialisat
ion S/w
Engineering</em></
li> </ul>
<a href
"http:homepage.h
tml">homepage.h
tml</a> </html>
OUTPUT:
Week-5
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 the 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
Department of CSE,GST Page 106
WEB TECHNOLOGY LAB
Author names column should
be displayed in one color and
should be captalized and in
bold.Use your own color for
remaining columns.
Use XML schemas XSL and
CSS for the above purpose.
Note: Give at least for 4 books.It
should be valid syntactivally.
Hint: You can use some xml editors
like XML-spy.
Source code:
< -- Book info.html-->
<html>
<head>
<title>Book
Information</
title> <script
language="ja
vascript">
function fun_next()
Department of CSE,GST Page 107
WEB TECHNOLOGY LAB
{
e.recordset.moveNext();
if(e.recordset.EOF)
{
window.alert("End of File reached");
}}
function fun__prev()
{
e.recordset.movePrev();
if(e.recordset.BOF)
{
window.alert("End of File reached");
}}
function fun_first()
{
e.recordset.moveFirst();
}
function fun_last()
{
e.recordset.moveLast();
}
</script>
</head>
<body>
<form
name="fn"
align="center">
<xml id="e"
src="Book.xml"
>
</xml>
<table id="book" datasrc="#e"
dataPageSize="2" border="2"
width="100" height="100"
align="center">
<thead
bgcolor="grey">
<tr>
<th>NAME</th>
<th>AUTHOR</th>
<th>ISBN</th>
<th>PUBLISHER</th>
<th>EDITION</th>
<th>PRICE</th>
</tr>
</thead>
<tbody>
<tr>
<td bgcolor="lightgreen"><span
datafld="NAME"></span></td>
<td bgcolor="lightblue"><b><span
datafld="AUTHOR"></span></b></
td>
<td bgcolor="lightgrey"><span
datafld="ISBN"></span></td>
<td bgcolor="lightgrey"><span
datafld="PUBLISHER"></span></td
> <td bgcolor="lightgreen"><span
datafld="EDITION"></span></td>
<td bgcolor="lightgreen"><span
datafld="PRICE"></span></td>
</tr>
</tbody>
</table>
<table align="center">
<input type="button" name="b1"
onClick="book.nextPage()"
value="Next"> <input
type="button" name="b2"
onClick="book.previousPage()"
value="Prev"> <input
type="button" name="b3"
onClick="book.firstPage()"
value="First"> <input
type="button" name="b4"
onClick="book.lastPage()"
value="Last"> </table>
</form>
</body>
</html>
< -- Book.xml -->
<?xml
version="1.0"
encoding="ISO-
8859-1"?> <?
xml-stylesheet
type="text/css"
href="Book_xsl.
xsl"?>
<CATALOG>
<BOOK>
<NAME>COMPLETE
REFERENCE</NAME>
Department of CSE,GST Page 112
WEB TECHNOLOGY LAB
<AUTHOR>HILBER
T
SCILTZ</AUTHOR>
<ISBN>1234</ISBN>
<PUBLISHER>TMH
</PUBLISHER>
<EDITION>SEVENT
</EDITION>
<PRICE>450</PRICE
>
</BOOK>
<BOOK>
<NAME>C LANGUAGE</NAME>
<AUTHOR>BALAGURUSWAMY<
/AUTHOR>
<ISBN>1235</ISBN>
<PUBLISHER>UNIVERSAL</PUB
LISHER>
<EDITION>FOURTH</EDITION>
<PRICE>250</PRICE>
Department of CSE,GST Page 113
WEB TECHNOLOGY LAB
</BOOK>
<BOOK>
<NAME>ASP.NET
</NAME>
<AUTHOR>O
REILLY</AUTHO
R>
<ISBN>1236</ISB
N>
<PUBLISHER>WRAX</PUBLISH
ER>
<EDITION>THIRD</EDITION>
<PRICE>350</PRICE>
</BOOK>
<BOOK>
<NAME>PHP</NA
ME>
<AUTHOR>KING
ADAM</AUTHOR
>
Department of CSE,GST Page 114
WEB TECHNOLOGY LAB
<ISBN>1237</ISBN
>
<PUBLISHER>DELHI</PUBLISH
ER>
<EDITION>SECON</EDITION>
<PRICE>150</PRICE>
</BOOK>
</CATALOG>
< -- Book_xsl .xsl -->
<?xml version="1.0"
encoding="ISO-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://w
ww.w3.org/1999/X
SL/Transform">
<xsl:tem
plate
match="/
Department of CSE,GST Page 115
WEB TECHNOLOGY LAB
">
<html>
<h2
align="center">
BOOKS
CATALOG</h2
> <table
border="1"
align="center">
<tr>
<th>NAME</th>
<th>AUTHOR</th>
<th>PUBLISHER</th>
<th>ISBN</th>
<th>EDITION</th>
<th>PRICE</th>
<th>Cart</th>
</tr>
<xsl:for-each
select="CATAL
Department of CSE,GST Page 116
WEB TECHNOLOGY LAB
OG/BOOK">
<tr>
<td><xsl:value-of
select="NAME"/></td>
<td
bgcolor="yellow"><b><xs
l:value-of
select="AUTHOR"/></b>
</td> <td><xsl:value-of
select="PUBLISHER"/></t
d>
<td><xsl:value-of
select="ISBN"/></t
d> <td><xsl:value-
of
select="EDITION"/
></td>
<td><xsl:value-of
select="PRICE"/><
/td> <td><input
type="button"
value="Add
Cart"/></td>
</tr>
</xsl:
for-
each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
< -- Output -- >
Week-6
Aim: Installation of Tomcat Apache 5.0
Apache Tomcat Installation:
Here we install Apache Tomcat 5.0
version. After download Tomcat we have
to follow the steps described
below.
Step: 1
Click on ‘jar’ file to run Tomcat. Then
the window appears like
Step: 2
Then the agreement license will appear
click on “I agree” to continue
Installation.
Step 3:
Component box will appear. Choose
which component you want and click
“next” to go to next wizard.
Step 4:
Select the path at where you want to
save the installation files, as default it
Department of CSE,GST Page 124
WEB TECHNOLOGY LAB
Step 4:
Then a window appears as it to specify
connector the port. And Administrator
login also there then it takes user name
as ‘admin’. As default it took “8081” as
shown below.
Step 5:
If there is any other process in that port
like ‘Oracle’ then we need change the
port number as shown and
click “Next” to go to next wizard. Here I
gave port “8081”
Step 6:
Then we have to choose select the path
of the JVM installed in our computer.
Automatically it took if it does not
select then we need to set the path.
Then click on “Install” to install the
files.
Step 7:
The files are extracted and installation is
running. If you want to know the details
of installation files click on “Show
details”. Then click on “Next”.
Step 8: This
is final wizard of installing Apache
Tomcat. Mark the option to Run Apache
Tomcat. And finally
click on “Finish” to finish the
installation.
password<input
type="password"length="10"
name="t2">
<br>
<input
type="submit
"
value="submi
t"> </form>
</centre>
</body>
</html>
Program
(valid.jav
a) import
javax.ser
vlet.*;
import
javax.ser
vlet.http.
*; import
java.io.*;
public void
Service(HttpServletRequest
request,HttpServletResponse
response)throws
ServletException,IOException
{
response.set
ContentType(
"text/html");
PrintWriter
out=response
.getWriter();
String
s1=request.g
etParameter(
"t1"); String
s2=request.g
etParameter(
"t2");
if(s1.equalsIgnoreCase("akhil")&&s2
.equalsIgnoreCase("ravi"))
ss="
Succ
ess";
else
username and
password
are"+ss);
out.close();
}
}
Program: (Web.xml)
<web-app>
<servlet>
<servlet-name>Valid</servlet-name>
<servlet-class>Valid</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Valid</servlet-name>
<url-pattern>/welcome1
</url-pattern>
</servlet-mapping>
</web-app>
Output:
How to compile servlet tomcat using
HTML and .java File.
appear:
Week-8
How to Create Data Source Name
(DSN) using oracle:
Go To Control Panel -> Choose
Administrative Tools
uid=document.getElemen
tById("uid").value; var
pwd=document.getEleme
ntById("pwd").value;
if(uid.length!=0 &&
pwd.length!=0)
{
return true;
}
else
{
alert("Missing UserName
or Password"); return
false;
}
}
</script>
<head>
<title>Login</title>
Department of CSE,GST Page 192
WEB TECHNOLOGY LAB
</head>
<body>
<form
action="confirm.jsp
" method="post">
<table>
<tr><th></th><th>Login</th></tr>
<tr><td>User
Name:</td><td><input type="text"
id="uid" name="uid"></td></tr>
<tr><td>Password:</td><td><input
type="password" id="pwd"
name="pwd"></td></tr>
Department of CSE,GST Page 193
WEB TECHNOLOGY LAB
<tr><td><input
type="submit"
value="Submit"
onclick="return
Validate()"></td><td><input
type="reset"></td></tr>
</table>
</form>
</body>
</html>
Program: (Confirm.jsp)
<html>
</html>
<%@page
import="jav
a.sql.*"%>
<%
try
{
String
uid=request.getPara
meter("uid"); String
pwd=request.getPara
meter("pwd"); String
pass="";
Class.forName("sun.jdbc.odbc.JdbcO
dbcDriver");
Connection
con=DriverManager.getConnection("
jdbc:odbc:oracle","sysman","tharun")
; PreparedStatement
ps=con.prepareStatement("select *
ps.setString(1,uid);
ResultSet
rs=ps.executeQue
while(rs.next())
{
Department of CSE,GST Page 196
WEB TECHNOLOGY LAB
pass=rs.getString(2);
if(pass.equals(pwd))
{
flag=1;
}
else
{
flag=0;
}
}
if(flag==1)
{
out.print("Success");
}
else
Department of CSE,GST Page 197
WEB TECHNOLOGY LAB
Week-9
JDBC
PRAC
TICE:
Progra
m:
(index.j
sp)
<html>
<script>
function Validate()
{
var
uid=document.getElementB
yId("uid").value; var
pwd=document.getElement
ById("pwd").value; var
rpwd=document.getElement
ById("rpwd").value;
name="uid"> <br/>
Password : <input
type="password" id="pwd"
name="pwd">
<br/> Retype-Password : <input
type="password" id="rpwd"
name="rpwd"> <br/> e-mail :
<input type="text" id="em"
name="em">
<br/> Ph No : <input type="text"
id="ph" name="ph">
<br/> <input type="submit"
value="Submit" onclick="return
Validate()"><input type=reset>
</body>
</form>
</html>
Progra
m:
(Registe
r.jsp)
<html>
Department of CSE,GST Page 203
WEB TECHNOLOGY LAB
</html>
<%@page
import="jav
a.sql.*" %>
<%
try
{
String
uid=request.getPa
rameter("uid");
String
pwd=request.getP
arameter("pwd");
String
em=request.getPa
rameter("em");
String
ph=request.getPar
ameter("ph");
Class.forName("sun.jdbc.odbc.JdbcOd
bc");
Connection
con=DriverManager.getConnectio
n("jdbc:odbc:oracle","sysman","th
arun"); PreparedStatement
ps=con.prepareStatement("insert
into register values(?,?,?,?)");
ps.setString(1,uid);
ps.setString(2,pwd);
ps.setString(3,em);
ps.setString(4,ph);
int
i=ps.execut
eUpdate();
if(i>0)
out.print("Insertion Successful <a
href=index.jsp>Click here to Add
More</a>");
else
out.print("Insertion Failed <a
href=index.jsp>Click here to Add
More</a>");
}
catch(Exception e)
{
out.print(e);
}
%>
Department of CSE,GST Page 207
WEB TECHNOLOGY LAB
Program: (Web.xml)
<w
eb-
app
>
</w
eb-
app
>
OUTPUT: