Top Banner
CS9228 WEB TECHNOLOGY LAB 1. Creation of HTML pages with frames, links, tables and other tags. 2. Usage of internal and external CSS along with HTML pages. 3. Client Side Programming. a. Javascript for displaying date and comparing two dates. b. Form validation including textfield, radio buttons, checkboxes, listbox and other controls 4. Usage of ASP/JSP objects Request, Response, Application, Session, Server, ADO etc. (Writing online applications such as Shopping, railway/air/bus ticket reservation system with set of ASP/JSP pages.) 5. Writing Servlet Program using HTTP Servlet. 6. Any online application with database access. (Write an ASP application for Telephone Directory using MS-ACCESS) 7. Creation of XML document for a specific domain. 8. Writing DTD or XML schema for the domain specific XML document. 9. Parsing an XML document using DOM and SAX Parsers. 10. Sample web application development in the open source environment.
90

Cs9228 Web Technology Lab Manual

Jan 02, 2016

Download

Documents

WEB TECHNOLOGY
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cs9228 Web Technology Lab Manual

CS9228 WEB TECHNOLOGY LAB

1. Creation of HTML pages with frames, links, tables and other tags.

2. Usage of internal and external CSS along with HTML pages.

3. Client Side Programming.

a. Javascript for displaying date and comparing two dates.

b. Form validation including textfield, radio buttons, checkboxes,

listbox and other controls

4. Usage of ASP/JSP objects Request, Response, Application, Session, Server,

ADO etc. (Writing online applications such as Shopping, railway/air/bus

ticket reservation system with set of ASP/JSP pages.)

5. Writing Servlet Program using HTTP Servlet.

6. Any online application with database access.

(Write an ASP application for Telephone Directory using MS-ACCESS)

7. Creation of XML document for a specific domain.

8. Writing DTD or XML schema for the domain specific XML document.

9. Parsing an XML document using DOM and SAX Parsers.

10. Sample web application development in the open source environment.

Page 2: Cs9228 Web Technology Lab Manual

CREATION OF STUDENT PROFILES USING HTML TAGS

AIM:

To develop a webpage to enter the student profiles.

ALGORITHM:

Step1: Start the program

Step 2: Using html tags, create table to enter the student profile

Step3: For each row of the table, enter the data using <td> such that

create student name,fathers name,address and e-mail,etc..

Step 4: Using <table> we have to enter the qualification of the

students.

Step 5: Using radio button,we have to choose the entertainment and

software exposure of the student.

Step 6: Using <form>, we have to create a declare text to type the text.

Step 7: Execute the web page in Internet explorer

Page 3: Cs9228 Web Technology Lab Manual

PROGRAM :

<html>

<head>

<title>Resume page</title>

</head>

<body bgcolor="#fffFF">

<center><font

color="#6600CC"><h1><b><b><u>PROFILE</u></b></b></h1></center></fo

nt>

<form name="input" action ="z:\WebTech Lab\webpageprofile.htm"

method="get">

<img height=100 width=100 src="z:\WebTech Lab\Photo.jpg" alt="angry

face">

<table border="3">

<td>Name:</td>

<td><input type="text" height='10' width='25'></td>

</tr>

<tr>

<td>Father Name:</td>

<td><input type="text" height='10' width='25'></td> </tr>

<tr>

<td>Mother Name:</td>

<td><input type="text" height='10' width='25'></td></tr>

<tr>

<td>Date Of Birth:</td>

<td><input type="text" height='10' width='25'></td></tr>

<tr>

<td>Marital Status:</td>

<td><input type="text" height='10' width='25'></td></tr>

<tr>

<td>Communication:</td>

<td colspan="4"><textarea name="male" rows="4"

cols='17'></textarea></td></tr>

<tr>

<td>Gender:</td>

<td>Male:<input type="checkbox" name="male">Female:<input

type="checkbox" name="female"></td>

</tr>

Page 4: Cs9228 Web Technology Lab Manual

<tr>

<th colspan="6">Educational Qualifications</th></tr>

<tr>

<th>Name of the Deg.</th><th>name of the degree</th><th>Name of the

Instistution</th><th>Year of

Pass</th><th>Grade</th><th>Specialization</th></tr>

<tr>

<td>SSLC:</td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

</tr>

<tr>

<td>HSC:</td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

</tr>

<tr>

<td>D.C.Tech:</td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

</tr>

<tr>

<td>M.C.A:</td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

</tr>

<tr>

<td>M.E:</td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

Page 5: Cs9228 Web Technology Lab Manual

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

<td><input type="text" height='10' width='25'></td>

</tr>

<br><br><br>

<tr>

<th colspan="6">Software Exposure</th>

</tr>

<tr>

<td>OS:</td>

<<td colspan="5">Windows XP/00/03<input type="checkbox"

name="male">LINUX<input type="checkbox" name="female">UNIX<input

type="checkbox" name="female">others<input type="checkbox"

name="female"></td>

</tr>

<tr>

<td>Languages:</td>

<td colspan="5">C:<input type="checkbox" name="male">C++:<input

type="checkbox" name="female">Java:<input type="checkbox"

name="female">J2EE:<input type="checkbox" name="female"></td>

</tr>

<tr>

<td>Extra Curriculam Acvtivities:</td>

<td colspan="5">Dance:<input type="checkbox"

name="male">Swimming:<input type="checkbox"

name="female">Shuttle:<input type="checkbox"

name="female">Music:<input type="checkbox" name="female"></td>

</tr>

<tr>

<td>Any Other Information:</td>

<td><input type="text" name="male"></td>

</tr>

<tr>

<center><th>Declaration:</th></center>

<td colspan="5"><textarea name="male" rows="5"

cols='70'></textarea></td>

</tr>

<tr>

<td>Date:</td>

<td><input type="text" name="male"></td>

<td>Place:</td>

<td><input type="text" name="male" ></td>

Page 6: Cs9228 Web Technology Lab Manual

</tr>

<tr>

<td><input type="Submit" value="submit"> <A

href="webpageprofile.htm"></A><br CLEAR=both></td>

<td><input type="reset" value="reset"></td>

</tr>

</center>

</body>

</html>

Page 7: Cs9228 Web Technology Lab Manual

SAMPLE OUTPUT :

RESULT:

Thus the web page for student profile has been created.

Page 8: Cs9228 Web Technology Lab Manual

DEVELOPING WEB SITE USING INTERNAL AND EXTERNAL CSS

ALONG WITH HTML PAGES.

AIM:

To develop a web site application using various html tags, forms,

attributes, css properties.

ALGORITHM:

Step 1: Start the program.

Step 2: Using html tags create a main page .

Step 3: Using link tags, open the various pages which links with the

main page.

Step 4: Using img tag, place the pictures in web page, wherever it is

needed.

Step 5: Using css properties create the link pages.

Step 6: Enter the details in link pages using html tags.

Step 7: Run the home page and click the link pages to view the details.

Step 8: Stop the program.

Page 9: Cs9228 Web Technology Lab Manual

PROGRAM:

Home.Html

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Home Page</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

<body>

<!-- Top panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="tp_bg1">

<a href="home.html"><img src="images/menu_home.gif" width="32"

height="10" alt="" class="flt menu_home"/></a>

<a href="aboutus.html"><img src="images/menu_about.gif" width="50"

height="10" alt="" class="flt menu_about" /></a>

<a href="#"><img src="images/menu_accnt.gif" width="52" height="10" alt=""

class="flt menu_accnt" /></a>

<img src="images/menu_tour.gif" width="30" height="10" alt="" class="flt

menu_tour" /></a>

<a href="#"><img src="images/menu_spl.gif" width="78" height="12" alt=""

class="flt menu_spl" /></a>

<a href="contact.html"><img src="images/menu_cntrl.gif" width="49"

height="10" alt="" class="flt menu_cntrl" /></a>

</td> </tr> <tr>

<td valign="top" class="tp_bg2">

<a href="#"><img src="images/logo.gif" width="169" height="54" alt=""

class="flt logo"/></a> </td>

</tr>

</table>

<!-- Top panel endz -->

<!-- Content panel -->

Page 10: Cs9228 Web Technology Lab Manual

<table border="0" cellpadding="0" cellspacing="0" width="1000"

style="background-color:#E4E6BE;" align="center">

<tr>

<td valign="top" width="698" style="padding-left:26px;"><p>&nbsp;</p>

<p>

<p><h2>Your interesting Air Travel</h2> </p><p> Curabitur mi nibh,

cursus vel, laoreet sit amet, aliquet sit amet, justo. Lorem ipsum dolor sit

amet, con- sectetuer adipiscing elit. Lorem ipsum dolor sit amet,

consectetuer adipiscing elit. Aenean vel magna. Nunc accumsan nulla. Nunc

feugiat cursus lorem. Cras turpis. <br />

<br />

Curabitur vel velit. Curabitur mi nibh, cursus vel, laoreet sit amet, aliquet

sit amet, justo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Pellentesque id nibh. Sed risus. Fusce quis velit eu felis vestibulum sceleris-

que. Nam lectus dolor, interdum at, mollis et, vehicula ut, sem. <a

href="#"></a> </p>

<p>&nbsp;</p> <p>&nbsp;</p>

<p>Latest News Lorem ipsum dolor sit amet, con- sectetuer adipiscing elit.

Aenean vel magna. Nunc accumsan nulla. <a href="#"></a> Curabitur mi

nibh, cursus vel, laoreet sit amet, aliquet sit amet, justo. Lorem ipsum

dolor.Curabitur mi nibh, cursus vel, laoreet. <a href="#"></a> </p>

<p>&nbsp;</p>

<table align="left" border="1" color="blue">

<tbody> <tr>

<td>&nbsp;USERNAME&nbsp;</td>

<td><input name="Input" /></td>

</tr>

<tr>

<td>&nbsp;PASSWORD&nbsp;</td>

<td><input name="password" type="password" value="" /></td>

</tr>

<tr>

<td colspan="4"><input type="button" value="SUBMIT"

name="submit" />

&nbsp; &nbsp;&nbsp;&nbsp;

<input type="reset" value=" RESET " name="clear" width="20" /></td>

</tr>

</tbody>

</table>

<p>&nbsp;</p>

<p><h2>&nbsp;</h2>

<p>&nbsp;</p>

Page 11: Cs9228 Web Technology Lab Manual

<h2>Hot Tours</h2>

</p>

<p><img src="images/cp_chinatwr.gif" width="273" height="92"

alt="" class="flt cp_chinatwr" /></p>

<p>&nbsp; </p> <p>&nbsp;</p> <p>&nbsp;</p>

<p>&nbsp;</p> <p>&nbsp; </p> <p>&nbsp;</p>

<p><a href="#"><img height="7" alt="" src="aboutus_cp_arrw.gif"

width="5" />Dolor sit amet, consectetuer adipis</a><br />

<img height="7" alt="" src="aboutus_cp_arrw.gif" width="5" /><a

href="#">Aliquam erat volutpat. Nulla id orci.</a><br />

<img height="7" alt="" src="aboutus_cp_arrw.gif" width="5" /><a

href="#">Phasellus congue justo quis leo.</a><br />

<img height="7" alt="" src="aboutus_cp_arrw.gif" width="5" /><a

href="#">sed urna imperdiet suscipit.</a> </p>

<p>&nbsp;</p>

<p>&nbsp;</p></td>

<td valign="top" width="41"><img src="images/spacer.gif" /></td>

</tr> <tr>

<td valign="top" colspan="4" style="background-color:#ffffff;">&nbsp;</td>

</tr>

</table>

<!-- Content panel endz -->

<!-- Footer panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="footer_bg">

<a href="#" class="cp_anchrtxt1">Home</a> <span

style="margin:0px 11px 0px 11px;">|</span> <a href="aboutus.html#"

class="cp_anchrtxt1"> About us </a> <span style="margin:0px 11px 0px

11px;">|</span> <a href="accounts.html" class="cp_anchrtxt1"> Accounts

</a> <span style="margin:0px 11px 0px 11px;">|</span> <a

href="booking.html" class="cp_anchrtxt1">Booking </a> <span

style="margin:0px 11px 0px 11px;">|</span> <a href="specialoffer.html"

class="cp_anchrtxt1"> Special Offers </a> <span style="margin:0px 11px 0px

11px;">|</span><a href="contact.html" class="cp_anchrtxt1">

Contacts</a><br /></td>

</tr>

</table>

<!-- Footer panel endz -->

</body>

</html>

Page 12: Cs9228 Web Technology Lab Manual

Aboutus.Html

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Home Page</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

<body>

<!-- Top panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="tp_bg1">

<a href="home.html"><img src="images/menu_home.gif" width="32"

height="10" alt="" class="flt menu_home"/></a>

<a href="aboutus.html"><img src="images/menu_about.gif" width="50"

height="10" alt="" class="flt menu_about" /></a>

<a href="#"><img src="images/menu_accnt.gif" width="52" height="10" alt=""

class="flt menu_accnt" /></a>

<img src="images/menu_tour.gif" width="30" height="10" alt="" class="flt

menu_tour" /></a>

<a href="#"><img src="images/menu_spl.gif" width="78" height="12" alt=""

class="flt menu_spl" /></a>

<a href="contact.html"><img src="images/menu_cntrl.gif" width="49"

height="10" alt="" class="flt menu_cntrl" /></a>

</td>

</tr>

<tr>

<td valign="top" class="tp_bg2">

<a href="#"><img src="images/logo.gif" width="169" height="54" alt=""

class="flt logo"/></a>

</td>

</tr>

</table>

<!-- Top panel endz -->

<!-- Content panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

style="background-color:#E4E6BE;" align="center">

<tr>

Page 13: Cs9228 Web Technology Lab Manual

<td valign="top" width="698" style="padding-

left:26px;"><p>&nbsp;</p>

<p><h2>About us </h2>

<p>To render adequate, efficient, safe and economical air services Best

airlines began its operation on 1st August, 2000 following the enactment of

Air Corporations Act 2000. Today, Best Airlines, together with its fully

owned subsidiary Alliance Air, has a fleet of 70 aircrafts. Since its very

inception Indian Airlines has been setting standards for civil aviation. With

many first in its credit, Indian Airlines has been feeding both the lavish and

economical requirements of passengers across the globe. Over the years,

Indian Airline has turned out to be synonymous with service, reliability and

efficiency. Best Airlines' network covers Singapore in the East and Kuwait

in the west and connects 18 destinations abroad. It's international network

spans Oman, Kuwait, UAE, Qatar and Bahrain in West Asia; Singapore,

Thailand, Malaysia and Mayanmar in South East Asia and Afghanistan,

Pakistan, Nepal, Bangladesh, Sri Lanka and Maldives in the South Asia sub-

continent. With a staff of over 500 thousand, Indian Airlines offers services

which are simply exemplary and quite unmatched.</p>

</p> </p>

<ul> <li>Business to Consumer Solutions </li> </ul>

<ul> <li>Internet Banking Solutions </li> </ul>

<ul> <li>Intranet Workflow Solutions </li> </ul>

<ul> <li>E-Governance Solutions </li> </ul>

<ul> <li>Corporate Wide E-Mail Infrastructure </li> </ul>

<ul><li>Internet/Intranet Security Solutions Dynamic Web Design and

Consultancy </li> </ul>

<ul><li>Domain Name Registration </li> </ul>

<ul> <li>Key Name Registration </li> </ul>

<ul><li>Web Sever Co-location Solutions </li> </ul>

<ul> <li>Call center Solutions </li> </ul>

<ul> <li>Company Wide Internet Connectivity </li> </ul>

<ul>

<li>Web Hosting solutions </li> </ul>

<ul> <li>Shared Hosting Services </li> </ul>

<ul> <li>Customer Relation Management (CRM) Solutions </li> </ul>

<p style="float:left;width:641px;margin-top:22px;"><span

style="float:left;font:11px/20px verdana;color:#29022A;margin:20px 0px 0px

0px;"><a href="#"></a> </span> </p>

</td>

<td valign="top" width="41"><img src="images/spacer.gif" /></td>

</tr>

<tr>

Page 14: Cs9228 Web Technology Lab Manual

<td valign="top" colspan="4" style="background-color:#ffffff;">&nbsp;</td>

</tr>

</table>

<!-- Content panel endz -->

<!-- Footer panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="footer_bg">

<a href="#" class="cp_anchrtxt1">Home</a> <span style="margin:0px 11px

0px 11px;">|</span> <a href="aboutus.html#" class="cp_anchrtxt1"> About

us </a> <span style="margin:0px 11px 0px 11px;">|</span> <a

href="accounts.html" class="cp_anchrtxt1"> Accounts </a> <span

style="margin:0px 11px 0px 11px;">|</span> <a href="booking.html"

class="cp_anchrtxt1">Booking </a> <span style="margin:0px 11px 0px

11px;">|</span> <a href="specialoffer.html" class="cp_anchrtxt1"> Special

Offers </a> <span style="margin:0px 11px 0px 11px;">|</span><a

href="contact.html" class="cp_anchrtxt1"> Contacts</a><br /></td>

</tr>

</table>

<!-- Footer panel endz -->

</body>

</html>

Booking.Html

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Home Page</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

<body>

<!-- Top panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="tp_bg1">

<a href="home.html"><img src="images/menu_home.gif" width="32"

height="10" alt="" class="flt menu_home"/></a>

Page 15: Cs9228 Web Technology Lab Manual

<a href="aboutus.html"><img src="images/menu_about.gif" width="50"

height="10" alt="" class="flt menu_about" /></a>

<a href="#"><img src="images/menu_accnt.gif" width="52" height="10" alt=""

class="flt menu_accnt" /></a>

<img src="images/menu_tour.gif" width="30" height="10" alt="" class="flt

menu_tour" /></a>

<a href="#"><img src="images/menu_spl.gif" width="78" height="12" alt=""

class="flt menu_spl" /></a>

<a href="contact.html"><img src="images/menu_cntrl.gif" width="49"

height="10" alt="" class="flt menu_cntrl" /></a>

</td> </tr> <tr>

<td valign="top" class="tp_bg2">

<a href="#"><img src="images/logo.gif" width="169" height="54" alt=""

class="flt logo"/></a> </td> </tr>

</table>

<!-- Top panel endz -->

<!-- Content panel -->

<Form>

<center><h2 style="color:BLUE">Ticket Booking </h2></center>

<table align=center border=2>

<tr>

<td>Departure <Input type=radio name="desparture"></td><td>Arriaval

<Input type=radio name="arrival"></td></tr>

<tr>

</tr>

<tr>

<td> From <Select>

<option> Chennai </option><option> Delhi</option>

<option> Kolkata</option><option> bangalore </option>

<option> London </option><option> Mumbai </option>

<option> Singapore</option><option> muscat</option>

</select>

</td>

<td>To <Select>

<option> Chennai </option><option> Delhi</option>

<option> Kolkata</option><option> bangalore </option>

<option> London </option><option> Mumbai </option>

<option> Singapore</option><option> muscat</option>

</select>

</td></tr>

<tr>

<td colspan=2> Date <Input type="text" ></td></tr>

Page 16: Cs9228 Web Technology Lab Manual

<tr><td> Adult <Select><option> 1</option>

<option> 2</option><option> 3</option>

<option> 4 </option><option> 5 </option>

<option> 6 </option><option> 7</option>

<option> 8 </option>

</select>

</td>

<td> Child <Select>

<option> 1</option><option> 2</option>

<option> 3</option><option> 4 </option>

<option> 5 </option><option> 6 </option>

<option> 7</option><option> 8 </option>

</select>

</td></tr>

<tr>

<td> Pay by Bank<Select>

<option> Indian bank</option><option> State bank</option>

<option> ICICI BANK</option><option> HDFC BANK </option>

<option> AXIS BANK </option><option> IDBI Bank </option>

<option> Indian overseas Bank</option><option> CITY BANK </option>

</select>

</td>

<td>Amount <Input type="text" ></td></tr>

<tr><td align=center colspan=2><Input type=submit value="submit">

<Input type=Reset value="Reset"></td></tr>

</table>

</form>

<!-- Content panel endz -->

<!-- Footer panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="footer_bg">

<a href="#" class="cp_anchrtxt1">Home</a> <span style="margin:0px 11px

0px 11px;">|</span> <a href="aboutus.html#" class="cp_anchrtxt1"> About

us </a> <span style="margin:0px 11px 0px 11px;">|</span> <a

href="accounts.html" class="cp_anchrtxt1"> Accounts </a> <span

style="margin:0px 11px 0px 11px;">|</span> <a href="booking.html"

class="cp_anchrtxt1">Booking </a> <span style="margin:0px 11px 0px

11px;">|</span> <a href="specialoffer.html" class="cp_anchrtxt1"> Special

Page 17: Cs9228 Web Technology Lab Manual

Offers </a> <span style="margin:0px 11px 0px 11px;">|</span><a

href="contact.html" class="cp_anchrtxt1"> Contacts</a><br /></td> </tr>

</table>

<!-- Footer panel endz -->

</body>

</html>

Contacts.html:

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Home Page</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

<body>

<!-- Top panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="tp_bg1">

<a href="home.html"><img src="images/menu_home.gif" width="32"

height="10" alt="" class="flt menu_home"/></a>

<a href="aboutus.html"><img src="images/menu_about.gif" width="50"

height="10" alt="" class="flt menu_about" /></a>

<a href="#"><img src="images/menu_accnt.gif" width="52" height="10" alt=""

class="flt menu_accnt" /></a>

<img src="images/menu_tour.gif" width="30" height="10" alt="" class="flt

menu_tour" /></a>

<a href="#"><img src="images/menu_spl.gif" width="78" height="12" alt=""

class="flt menu_spl" /></a>

<a href="contact.html"><img src="images/menu_cntrl.gif" width="49"

height="10" alt="" class="flt menu_cntrl" /></a>

</td>

</tr>

<tr>

<td valign="top" class="tp_bg2">

Page 18: Cs9228 Web Technology Lab Manual

<a href="#"><img src="images/logo.gif" width="169" height="54" alt=""

class="flt logo"/></a>

</td>

</tr>

</table>

<!-- Top panel endz -->

<!-- Content panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

style="background-color:#E4E6BE;" align="center">

<tr>

<td valign="top" width="698" style="padding-left:26px;"><p>&nbsp;</p>

<p><h2>Email Supporting </h2>

<p>Use the form below to get in touch with us in connection with the travel

related queries. </p>

<table>

<tbody>

<tr>

<td>Name</td>

<td><input name="Input" width="25" height="10" /></td>

</tr>

<tr>

<td>email ID</td>

<td><input name="Input2" width="25" height="10" /></td>

</tr>

<tr>

<td>subject</td>

<td><select name="subject">

<option value="Delhi" selected="selected">Delhi</option>

<option value="mumbai">mumbai</option>

<option value="chennai">chennai</option>

<option value="kolkata">kolkata</option>

<option value="bangalore">bangalore</option>

<option value="covai">covai</option><option

value="singapure">singapure</option>

<option value="muscat">muscat</option>

</select></td>

</tr>

Page 19: Cs9228 Web Technology Lab Manual

<tr>

<td>location</td>

<td><select name="location">

<option value="reservation" selected="selected">reservation</option>

<option value="product and services">product and services</option>

<option value="complients and compliments">complients and

compliments</option>

<option value="fares and tickets">fares and tickets</option>

<option value="frequently flyer">frequently flyer</option>

<option value="feedback">feedback</option>

<option value="others">others</option>

&gt;

</select></td>

</tr>

<tr>

<td>Descrption</td>

<td colspan="5"><textarea name="male" rows="5"

cols="70"></textarea></td>

</tr>

</tbody>

</table></td>

<td valign="top" width="41"><img src="images/spacer.gif" /></td>

</tr>

<tr>

<td valign="top" colspan="4" style="background-color:#ffffff;">&nbsp;</td>

</tr>

</table>

<!-- Content panel endz -->

<!-- Footer panel -->

<table border="0" cellpadding="0" cellspacing="0" width="1000"

align="center">

<tr>

<td valign="top" class="footer_bg">

<a href="#" class="cp_anchrtxt1">Home</a> <span style="margin:0px 11px

0px 11px;">|</span> <a href="aboutus.html#" class="cp_anchrtxt1"> About

us </a> <span style="margin:0px 11px 0px 11px;">|</span> <a

href="accounts.html" class="cp_anchrtxt1"> Accounts </a> <span

style="margin:0px 11px 0px 11px;">|</span> <a href="booking.html"

class="cp_anchrtxt1">Booking </a> <span style="margin:0px 11px 0px

11px;">|</span> <a href="specialoffer.html" class="cp_anchrtxt1"> Special

Offers </a> <span style="margin:0px 11px 0px 11px;">|</span><a

href="contact.html" class="cp_anchrtxt1"> Contacts</a><br /></td>

Page 20: Cs9228 Web Technology Lab Manual

</tr>

</table>

<!-- Footer panel endz -->

</body>

</html>

Sample Output :

Page 21: Cs9228 Web Technology Lab Manual

RESULT:

Thus the website has been developed sucessfully.

Page 22: Cs9228 Web Technology Lab Manual

CLIENT SIDE PROGRAMMING JAVASCRIPT FOR DISPLAYING

DATE AND COMPARING TWO DATES

AIM:

To validate the student profile using javascript.

ALGORITHM:

Step 1: start the program.

Step 2: Design a home page student profile using different html tags,

forms and attributes.

Step 3: Using javascript, we validate whether the text and other text

fields are empty or to be filled.

Step 4: Check whether the checkbox has been already checked or not.

Step 5: Check whether the radio button has been already checked or

not.

Step 6: Check whether the nick name is used as a password or not.

Step 7: Validate the date of birth that should be in date format(dd-mm-

yy) or not.

Step 8: Allow the age field size should be two and only be the numbers.

Step 9: In the name field, ensure that it should allow only the capital

letters.

Step 10: Check that the password field contains only the 8 characters.

Step 11: Execute the program in Internet explorer.

Step 12: Stop the program.

Page 23: Cs9228 Web Technology Lab Manual

PROGRAM:

<html>

<head>

<title>Compare Dates</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<Script Language=Javascript>

function CompareDates()

{

var str1 = document.getElementById("Fromdate").value;

var str2 = document.getElementById("Todate").value;

var dt1 = parseInt(str1.substring(0,2),10);

var mon1 = parseInt(str1.substring(3,5),10);

var yr1 = parseInt(str1.substring(6,10),10);

var dt2 = parseInt(str2.substring(0,2),10);

var mon2 = parseInt(str2.substring(3,5),10);

var yr2 = parseInt(str2.substring(6,10),10);

var date1 = new Date(yr1, mon1, dt1);

var date2 = new Date(yr2, mon2, dt2);

if(date2 < date1)

{

alert("To date cannot be greater than from date");

return false;

}

else

{

alert("Submitting ...");

document.form1.submit();

}

}

</Script>

</head>

<body bgcolor="#FFFFdd" text="#000000">

<br>

<br>

<h1 align=center style={color:maroon}><u>Date

Comparison</u></h1><br><br>

<center>

<form name="form1" method="post" action="">

Page 24: Cs9228 Web Technology Lab Manual

<input type="text" name="fromdate" id="fromdate" value="">

<input type="text" name="todate" id="todate" value=""><br><br><br>

<input type="button" value="compare dates" onclick="CompareDates()">

</form>

</center>

</body>

</html>

Sample Output:

RESULT:

Thus the program for Javascript for displaying date and comparing

two Dates has been successfully compiled and executed..

Page 25: Cs9228 Web Technology Lab Manual

FORM VALIDATION INCLUDING TEXTFIELD, RADIO BUTTONS,

CHECKBOXES, LISTBOX AND OTHER CONTROLS

AIM:

To validate the student profile using javascript.

ALGORITHM:

Step 1: start the program.

Step 2: Design a home page student profile using different html

tags,forms and attributes.

Step 3: Using javascript, we validate whether the text and other text

fields are empty or to be filled.

Step 4: Check whether the checkbox has been already checked or not.

Step 5: Check whether the radio button has been already checked or

not.

Step 6: Check whether the nick name is used as a password or not.

Step 7: Validate the date of birth that should be in date format(dd-mm-

yy) or not.

Step 8: Allow the age field size should be two and only be the numbers.

Step 9:In the name field,ensure that it should allow only the capital

letters.

Step 10:Check that the password field contains only the 8 characters.

Step 11:Execute the program in Internet explorer.

Step 12:Stop the program.

Page 26: Cs9228 Web Technology Lab Manual

PROGRAM :

<html>

<head><title> from validation </title>

function checkEmail (strng) {

var error="";

if (strng == "") {

error = "You didn't enter an email address.\n";

}

var emailFilter=/^.+@.+\..{2,3}$/;

if (!(emailFilter.test(strng))) {

error = "Please enter a valid email address.\n";

}

else {

//test email for illegal characters

var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/

if (strng.match(illegalChars)) {

error = "The email address contains illegal characters.\n";

}

}

return error;

}

// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {

var error = "";

if (strng == "") {

error = "You didn't enter a phone number.\n";

}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-

numeric characters

if (isNaN(parseInt(stripped))) {

error = "The phone number contains illegal characters.";

}

if (!(stripped.length == 10)) {

error = "The phone number is the wrong length. Make sure you

included an area code.\n";

}

return error;

}

// password - between 6-8 chars, uppercase, lowercase, and numeral

Page 27: Cs9228 Web Technology Lab Manual

function checkPassword (strng) {

var error = "";

if (strng == "") {

error = "You didn't enter a password.\n";

}

var illegalChars = /[\W_]/; // allow only letters and numbers

if ((strng.length < 6) || (strng.length > 8)) {

error = "The password is the wrong length.\n";

}

else if (illegalChars.test(strng)) {

error = "The password contains illegal characters.\n";

}

else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) &&

(strng.search(/(0-9)+/)))) {

error = "The password must contain at least one uppercase letter, one

lowercase letter, and one numeral.\n";

}

return error;

}

// username - 4-10 chars, uc, lc, and underscore only.

function checkUsername (strng) {

var error = "";

if (strng == "") {

error = "You didn't enter a username.\n";

}

var illegalChars = /\W/; // allow letters, numbers, and underscores

if ((strng.length < 4) || (strng.length > 10)) {

error = "The username is the wrong length.\n";

}

else if (illegalChars.test(strng)) {

error = "The username contains illegal characters.\n";

}

return error;

}

// non-empty textbox

Page 28: Cs9228 Web Technology Lab Manual

function isEmpty(strng) {

var error = "";

if (strng.length == 0) {

error = "The mandatory text area has not been filled in.\n"

}

return error;

}

// was textbox altered

function isDifferent(strng) {

var error = "";

if (strng != "Can\'t touch this!") {

error = "You altered the inviolate text area.\n";

}

return error;

}

// exactly one radio button is chosen

function checkRadio(checkvalue) {

var error = "";

if (!(checkvalue)) {

error = "Please check a radio button.\n";

}

return error;

}

// valid selector from dropdown list

function checkDropdown(choice) {

var error = "";

if (choice == 0) {

error = "You didn't choose an option from the drop-down list.\n";

}

return error;

}

</head>

</html>

Page 29: Cs9228 Web Technology Lab Manual

Sample output:

RESULT:

Thus the web page for student profile has been developed and

validated successfully.

Page 30: Cs9228 Web Technology Lab Manual

STUDENT INFORMATION SYTEM USING JSP AND SERVLET

AIM:

To develop the student webpage information using java servlet and

JDBC.

ALGORITHM :

Start the program

Create main HTML page for student database maintenance

Select option to do the following operation

Insertion, search ,delete and modify or update the student recode

Main.Html

<html>

<body bgcolor=yellow text=red>

<div align=center>

<label><h2>Student database maintenance</h2> </label>

<TABLE>

<TR><TD><a

href="http://localhost:7001/student/register.html">REGISTER</a></TD></T

R>

<TR><TD><a

href="http://localhost:7001/student/find3">SEARCH</a></TD></TR>

<TR><TD><a href="http://localhost:7001/student/viewall">VIEW ALL

</a></TD></TR>

<TR><TD><a

href="http://localhost:7001/student/delete2.html">DELETE</a></TD></TR>

<!--<TR><TD><a

href="http://localhost:7001/student/update">UPDATE</a></TD></TR>-->

</table>

</div></body></html>

Page 31: Cs9228 Web Technology Lab Manual

Register.HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> registration </TITLE>

</HEAD>

<BODY bgcolor=teak text=red>

<form action="http://localhost:7001/student/register1" method=post>

<pre>

Enter Id : <input type=text name="id" size=4 ><br>

Enter Name : <input type=text name="name" size=20 ><br>

Enter Age : <input type=text name="age" size=4 ><br>

Enter Branch: <input type=text name="branch" size=10 ><br>

Enter Mark1 : <input type=text name="m1" size=4 ><br>

Enter Mark2 : <input type=text name="m2" size=4 ><br>

Enter Mark3 : <input type=text name="m3" size=4 ><br>

Enter Grade : <input type=text name="grade" size=20 ><br>

Click : <input type="submit" name="submit" value=register>

</pre></form></BODY></HTML>

Insert.Html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> registration </TITLE>

</HEAD>

<BODY bgcolor=teak text=red>

<form action="http://localhost:7001/student/insert" method=post>

<pre>

<div align=center>

Enter Id : <input type=text name="id" size=4 ><br>

Enter Name : <input type=text name="name" size=20 ><br>

Enter Age : <input type=text name="age" size=4 ><br>

Enter Branch: <input type=text name="branch" size=10 ><br>

Enter Mark1 : <input type=text name="m1" size=4 ><br>

Enter Mark2 : <input type=text name="m2" size=4 ><br>

Enter Mark3 : <input type=text name="m3" size=4 ><br>

Enter Grade : <input type=text name="grade" size=4 ><br>

<input type="submit" name="submit" value=register>

Page 32: Cs9228 Web Technology Lab Manual

</div></pre></form></BODY></HTML>

Delete.Html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> DELETE STUDENT RECORD </TITLE></HEAD>

<BODY bgcolor=yellow text=cyan>

<form action="http://localhost:7001/student/delete2" method=post>

<pre>

Enter the ID :<input type=text name="idno" size=4 ><br>

Click :<input type="submit" name=submit value=delete>

</pre>

</form>

</BODY>

</HTML>

Second.java

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

import java.lang.*;

public class second extends HttpServlet

{

public void doGet(HttpServletRequest req,HttpServletResponse

res)throws ServletException,IOException

{

loginform(res,false);

}//goGet()

private void loginform(HttpServletResponse res,boolean error)throws

ServletException,IOException

{

res.setContentType("text/html");

PrintWriter pr=res.getWriter();

pr.println("<html><body bgcolor=blue text=red>");

pr.println("<div align=center>");

if(error)

{

Page 33: Cs9228 Web Technology Lab Manual

pr.println("<H2>LOGIN FAILED, PLEASE TRY

AGAIN!!!</H2>");

}

pr.println("<form method=post NAME=FORM>");

pr.println("<table><TR><TD><label> please enter your name

and password</label></TR></TD>");

pr.println("<TR><TD>Username:<input type=text

name=username> ");

pr.println("<TR><TD>Password:<input type=password

name=password><br></TR></TD><hr width=100%></TR></TD>");

pr.println("<TR><TD>Press:<input type=submit name=submit

value=Continue></TR></TD>");

pr.println("<TR><TD>clear:<input type=reset name =reset

value=Clear></TR></TD></TABLE>");

pr.println("</form></div></body></html>");

}//loginform()

public void doPost(HttpServletRequest req,HttpServletResponse

res)throws ServletException,IOException

{

String name=req.getParameter("username");

String pass=req.getParameter("password");

if(logindb(name,pass))

{

RequestDispatcher rd=req.getRequestDispatcher("/main.html");

rd.forward(req,res);

}

else

{

loginform(res,true);

}

}//doPost()

boolean logindb(String name, String pass)

{

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection

con=DriverManager.getConnection("jdbc:odbc:logindb");

Statement s=con.createStatement();

String sql="select * from stu where username= '" + name

+ "' AND password= '" + pass + "' ";

Page 34: Cs9228 Web Technology Lab Manual

ResultSet rs=s.executeQuery(sql);

if(rs.next())

{

return true;

}

con.close();

}

catch(SQLException s)

{

s.printStackTrace();

}

catch(Exception e)

{

e.printStackTrace();

}

return false;

}//login()

};

Register1.java

/* INSERTING THE DATA */

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

import java.sql.*;

import java.lang.*;

public class register1 extends HttpServlet

{

public void doPost(HttpServletRequest req,HttpServletResponse

res)throws ServletException, IOException

{

try

{

res.setContentType("Text/html");

PrintWriter pr=res.getWriter();

int id=Integer.parseInt(req.getParameter("id"));

String name=req.getParameter("name");

int age=Integer.parseInt(req.getParameter("age"));

String branch=req.getParameter("branch");

int m1=Integer.parseInt(req.getParameter("m1"));

Page 35: Cs9228 Web Technology Lab Manual

int m2=Integer.parseInt(req.getParameter("m2"));

int m3=Integer.parseInt(req.getParameter("m3"));

String grade=req.getParameter("grade");

pr.println("<html><body bgcolor=yellow text=red><div

align=center>");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:ss");

//pr.println("student information are successfully registered");

//pr.println("<a

href=http://localhost:7001/student/main.html>goto main page</a>");

PreparedStatement pst=con.prepareStatement("Insert into

studata values(?,?,?,?,?,?,?,?) ");

pst.setInt(1,id);

pst.setString(2,name);

pst.setInt(3,age);

pst.setString(4,branch);

pst.setInt(5,m1);

pst.setInt(6,m2);

pst.setInt(7,m3);

pst.setString(8,grade);

pst.executeQuery();

pr.println("student information are successfully registered");

pr.println("<a

href=http://localhost:7001/student/main.html>goto main page</a>");

pr.println("</html></body>");

con.commit();

}

catch(SQLException e)

{

System.out.println(e.getMessage());

}

catch(Exception e)

{

e.printStackTrace();

}

}

};

Page 36: Cs9228 Web Technology Lab Manual

Insert.java

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

import java.sql.*;

import java.lang.*;

public class register extends HttpServlet

{

public void doPost(HttpServletRequest req,HttpServletResponse

res)throws ServletException, IOException

{

try

{

res.setContentType("Text/html");

PrintWriter pr=res.getWriter();

int id=Integer.parseInt(req.getParameter("id"));

String name=req.getParameter("name");

int age=Integer.parseInt(req.getParameter("age"));

String branch=req.getParameter("branch");

int m1=Integer.parseInt(req.getParameter("m1"));

int m2=Integer.parseInt(req.getParameter("m2"));

int m3=Integer.parseInt(req.getParameter("m3"));

String grade=req.getParameter("grade");

pr.println("<html><body bgcolor=yellow text=red><div

align=center>");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:ss");

// pr.println("Get connection");

PreparedStatement pst=con.prepareStatement("Insert into

studata values(?,?,?,?,?,?,?,?) ");

pst.setInt(1,id);

pst.setString(2,name);

pst.setInt(3,age);

pst.setString(4,branch);

pst.setInt(5,m1);

pst.setInt(6,m2);

pst.setInt(7,m3);

pst.setString(8,grade);

pst.executeQuery();

Page 37: Cs9228 Web Technology Lab Manual

con.commit();

pr.println("student information are successfully registered");

pr.println("<a

href=http://localhost:7001/student/main.html>goto main page</a>");

pr.println("</html></body>");

con.close();

}

catch(SQLException e)

{

System.out.println(e.getMessage());

}

catch(Exception e)

{

e.printStackTrace();

}

}

};

Find3.Java

/* SEARCH THE PARTICULAR RECORD */

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

import java.sql.*;

import java.lang.*;

public class find3 extends HttpServlet

{

public void doGet(HttpServletRequest req,HttpServletResponse res)throws

ServletException, IOException

{

res.setContentType("Text/html");

PrintWriter pr=res.getWriter();

pr.println("<html><body bgcolor=black text=green><div

align=center>");

pr.println("<form action=http://localhost:7001/student/find3

method=post name=form1>");

pr.println("<h4>Enter the student ID:</h4><input type=text name=id

>");

Page 38: Cs9228 Web Technology Lab Manual

pr.println("<h4>click:</h4><input type=submit name=submit

value=search>");

pr.println("</form></div></body></html>");

}

public void doPost(HttpServletRequest req,HttpServletResponse

res)throws ServletException, IOException

{

try

{

res.setContentType("Text/html");

PrintWriter pr=res.getWriter();

String id =req.getParameter("id");

int idno=Integer.parseInt(id);

pr.println("<html><body bgcolor=black text=green><div

align=center>");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:ss");

//PreparedStatement pst=con.prepareStatement("select * from studata where

ID= '" + idno + "' ");

PreparedStatement pst=con.prepareStatement("select * from studata where

ID= ? ");

pst.setInt(1,idno);

ResultSet r=pst.executeQuery();

while(r.next())

{

pr.println(r.getInt(1)+"\t"+r.getString(2)+"\t"+r.getInt(3)+"\t"+r.getSt

ring(4)+"\t"+r.getInt(5)+"\t"+r.getInt(6)+"\t"+r.getInt(7)+"\t"+r.getString(8)

);

pr.println("<br>");

}

pr.println("<a href=http://localhost:7001/student/main.html>goto main

page</a>");

pr.println("</html></body>");

}

catch(SQLException e)

{

System.out.println(e.getMessage());

}

catch(Exception e)

{

e.printStackTrace();

Page 39: Cs9228 Web Technology Lab Manual

}

}

};

Delete2.java

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

import java.sql.*;

import java.lang.*;

public class delete2 extends HttpServlet

{

public void doPost(HttpServletRequest req,HttpServletResponse

res)throws ServletException, IOException

{

try

{

res.setContentType("Text/html");

PrintWriter pr=res.getWriter();

pr.println("<html><body bgcolor=black text=yellow>");

String idno=req.getParameter("idno");

int id=Integer.parseInt(idno);

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:ss");

pr.println("get connected");

//PreparedStatement pst=con.prepareStatement("Delete from studata

where ID= '" + id + "' ");

PreparedStatement pst=con.prepareStatement("Delete from studata

where ID= ? ");

pst.setInt(1,id);

pst.executeUpdate();

pr.println("<h2>student record is successfully deleted");

pr.println("<a href=http://localhost:7001/student/main.html>goto main

page</a>");

pr.println("</html></body>");

con.commit();

}

catch(SQLException e)

{

System.out.println(e.getMessage());

Page 40: Cs9228 Web Technology Lab Manual

}

catch(Exception e)

{

e.printStackTrace();

}

}

};

Output:

Studenttable.

Page 41: Cs9228 Web Technology Lab Manual
Page 42: Cs9228 Web Technology Lab Manual

RESULT :

Thus student information java script program is successfully

completed.

Page 43: Cs9228 Web Technology Lab Manual

SERVLET PROGRAM USING HTTP SERVLET

AIM:

To create a servlet program and check the script validation.

ALGORITHM:

Step 1: Start the program.

Step 2: Get the context text at Servlet at text html.

Step 3: Get the response from the user by entering the username field.

Step 4: Get the response from the user by entering the password field.

Step 5: If the username and password are correct, then the user is

authenticated and can enter into web page.

Step 6: Execute the program in Internet Explorer.

Stepe 7: Stop the program.

Page 44: Cs9228 Web Technology Lab Manual

PROGRAM

HTML Code :

<HTMl>

<HEAD><CENTER> </CENTER></HEAD>

<CENTER>

<body bgcolor="green">

<form action="http://localhost:7001/parthi_servlet/servlet1" method="get">

<h1>USERNAME AND PASSWORD></h1>

<TABLE >

<TR>

<TD>USERNAME<INPUT TYPE="TEXT" name="username"></TD></TR>

<TR>

<TD> PASSWORD<INPUT TYPE="password"

name="password"></TD></TR>

<TR>

<TD> <INPUT TYPE="submit" VALUE="SUBMIT" NAME=SUB></TD>

<TD> <INPUT TYPE="reset" VALUE="CLEAR" NAME=CLA></TD>

</TR>

</TABLE></CENTER>

</form>

</body>

</HTML>

Java Servlet Code :

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class servlet1 extends HttpServlet

{

public void doGet(HttpServletRequest req,HttpServletResponse res)throws

ServletException,IOException

{

res.setContentType("text/html");

PrintWriter pw=res.getWriter();

String admin=req.getParameter("username");

String pass=req.getParameter("password");

pw.println(admin);

pw.println(pass);

Page 45: Cs9228 Web Technology Lab Manual

if((admin.equals("admin2010")) && (pass.equals("abc123")))

{

pw.println("Authorized user");

}

else

{

pw.println("not an Authorized user");

}

}

}

Page 46: Cs9228 Web Technology Lab Manual

Sample output:

RESULT:

Thus the servlet program has been created and validated

successfully.

Page 47: Cs9228 Web Technology Lab Manual

IMPLEMENTATION OF JAVA DATABASE CONNECTIVITY(JDBC)

AIM:

To connect the database using jdbc connectivity in java.

ALGORITHM:

Step 1:Start the program.

Step2 :Write the source code for connectivity.

Step 3:Using MS-Access, save the database.

Step 4:connect the database using ODBC Source connection.

Step 5: Add the database name in ODBC data source administrator.

Step 6:Add the table name to connection.

Step 7:Compile the program and execute it.

Step 8:Stop the program.

Page 48: Cs9228 Web Technology Lab Manual

PROGRAM

import java.sql.*;

import java.io.*;

public class jdbcdemo

{

public static void main(String args[])

{

Connection c= null;

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

c=DriverManager.getConnection("jdbc:odbc:jdbcdemodb");

Statement stmt=c.createStatement();

ResultSet rs=stmt.executeQuery("select * from Employee");

System.out.println("name and password are");

while(rs.next())

{

System.out.println(rs.getString(1)+"\t"+rs.getInt(2)+"\t"+rs.getDouble(3));

}

c.close();

}

catch(SQLException e1)

{

e1.printStackTrace();

}

catch(Exception e)

{

System.out.println("error"+e.getMessage());

}

}

}

Page 49: Cs9228 Web Technology Lab Manual

Sample output:

RESULT:

Thus the implementation of Java Database connectivity has been

executed successfully.

Page 50: Cs9228 Web Technology Lab Manual

IMPLEMENTATION OF SERVLET - JDBC DEMO PROGRAM

AIM:

To create a servlet with JDBC connectivity in java.

ALGORITHM:

Step 1:Start the program.

Step 2:Get the context text at Servlet at text html.

Step 3:Get the response from the user by entering the username field.

Step 4: Get the response from the user by entering the password field.

Step 5:If the username and password are correct, then the user is

authenticated

and can enter into web page.

Step 6:Execute the program in Internet Explorer.

Step 7 :Write the source code for connectivity.

Step 8:Using MS-Access, save the database.

Step 9:connect the database using ODBC Source connection.

Step 10: Add the database name in ODBC data source administrator.

Step 11:Add the table name to connection.

Step 12:Compile the program and execute it.

Step 13 :Stop the program.

Page 51: Cs9228 Web Technology Lab Manual

PROGRAM

import javax.servlet.*;

import java.io.*;

import java.sql.*;

public class servletdemojdbc implements Servlet

{

public void init(ServletConfig c) throws ServletException

{

//super.init(c);

System.out.println("joint method");

}

public void service(ServletRequest req,ServletResponse res)throws

ServletException,IOException

{

Connection c= null;

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

c=DriverManager.getConnection("jdbc:odbc:jdbcdemo");

Statement stmt=c.createStatement();

ResultSet rs=stmt.executeQuery("select * from Employee");

System.out.println("name and password are");

while(rs.next())

{

System.out.println(rs.getString(1)+"\t"+rs.getInt(2)+"\t"+rs.getDouble(3));

}

c.close();

}

catch(SQLException e1)

{

e1.printStackTrace();

}

catch(Exception e)

{

System.out.println("error"+e.getMessage());

}

System.out.println("exec ");

}

public String getServletInfo()

{

String author="raman";

Page 52: Cs9228 Web Technology Lab Manual

String program="c";

System.out.println(author+"wrote"+program);

return null;

}

public ServletConfig getServletConfig()

{

return null;

}

public void destroy()

{

}

}

Page 53: Cs9228 Web Technology Lab Manual

Sample output:

RESULT:

Thus the program for database connectivity using jdbc has been

created and executed successfully

Page 54: Cs9228 Web Technology Lab Manual

SAMPLE WEB APPLICATION DEVELOPMENT IN THE OPEN

SOURCE ENVIRONMENT WITH DATABASE ACCESS.

AIM:

To create Sample web application development in the open source

environment.

ALGORITHM :

Step1: start the program

Step2: Inside the asp definiton tag include the html contents

Step3: include the code for the database connectivity using the ado object

Step4: select all the datas form the student table

Step5: Traverse all the tuples in the table

Step6: Print the datas

Step7: close the connection

Step8: stop the program

Page 55: Cs9228 Web Technology Lab Manual

Programs:

access.asp file:

<% Option Explicit %>

<html>

<% DIM name

set con=Server.CreateObject("ADODB.Connection">

con.open "dsn=cse;"

set rs=Server.Createobject("ADODB.RecordSet")

set rs=con.Execute("select * from student where name="&name&")%>

<table border="," width="50"%>

<% while NOT rs.EOF %>

<tr><% for t=0 to 6 %>

<td><% Response.write(rs(i)) %>

<% NEXT %></td></tr>

<% Move Next wend %></table>

<%con.close%>

</html>

stuaccess.html file:

<html>

<form action="access.asp" method="post">

Name<input type="text" name="Name"><br><br>

<input type="submit">

<input type="reset">

</form>

</html>

Page 56: Cs9228 Web Technology Lab Manual

Sample Output:

RESULT :

Thus the Sample web application development in the open source

environment has been executed successfully executed.

Page 57: Cs9228 Web Technology Lab Manual

CREATION OF XML DOCUMENT FOR A SPECIFIC DOMAIN.

AIM:

To creation of XML document for a specific domain

ALGORITHM:

Step1:start the program

Step2:using Onclick(),validate the student details as entered.

Step3:In XML file,we use styles for structure the program as

#PCDATA(datafield)

Step4:Using various HTML tags and attribute,we design the web page.

Step5:Using various XML attribute list and entity list to retrieve the

information of student.

Step6:Using processing instructions which we required to describe the

data.

Step7:Using “note.xml”as xmlid to connect with html file.Execute the

program.

Step8:Stop the program.

Page 58: Cs9228 Web Technology Lab Manual

Program

Student.html:

<HTML>

<HEAD>

<SCRIPT>

function prev_onclick()

{

std.previousPage()

}

function next_onclick()

{

std.nextPage()

}

</SCRIPT>

</HEAD>

<BODY>

<xml id="note" src="note.xml"></xml>

<table id="std" dataSrc="#note" datapagesize="1" border="1">

<thead>

<tr><th>REGNO</th><th>NAME</th><th>COURSE</th><TH>SEM</th></

tr>

</thead>

<tbody>

<tr><td><span datafld="REGNO"></span></td>

<td><span datafld="NAME"></span></td>

<td><span datafld="COURSE"></span></td>

<td><span datafld="SEM"></span></td>

</tr>

</tbody>

</table>

<INPUT TYPE="BUTTON" VALUE="NEXT" ONCLICK="next_onclick()">

<INPUT TYPE="BUTTON" VALUE="PREVIOUS"

ONCLICK="prev_onclick()">

</BODY>

</HTML>

note.xml:

<?xml version="1.0"?>

Page 59: Cs9228 Web Technology Lab Manual

<note>

<STUDENT>

<REGNO>VMP49</REGNO>

<NAME>THANUJA.O</NAME>

<COURSE>M.E CSE</COURSE>

<SEM>II</SEM>

</STUDENT>

<STUDENT>

<REGNO>VMP52</REGNO>

<NAME>TAMILARASI</NAME>

<COURSE>M.E CSE</COURSE>

<SEM>II</SEM>

</STUDENT>

</note>

Sample Output :

RESULT :

Thus the developing XML program has been executed successfully.

Page 60: Cs9228 Web Technology Lab Manual

WRITING DTD OR XML SCHEMA FOR THE DOMAIN SPECIFIC

XML DOCUMENT

AIM:

To write a program for DTD and XML schema for the domain specific

XML document.

ALGORITHM:

Step1:start the program

Step2:open an XML file as Letter.xml, to create detail of person using

various xml attribute list

Step3:using user defined tags, we can create details of person using

name, pincode, address, ph.no, etc..

Step4:open DTD file as letter . dtd

Step5:using an external and internaldtd,we create elementlist as

#PCDATA for retrieve the datafield

Step6:using attribute declaration ,use to retrieve the datafield as more

than one time

Step7:Execute the program

Page 61: Cs9228 Web Technology Lab Manual

Program:

Letter.xml:

<?xml version="1.0"?>

<letter>

<contact type="sender">

<name>aaaa</name>

<address>dfdsgdsgdsfvg</address>

<city>chennai</city>

<state>tamilnadu</state>

<zip>600089</zip>

<phone>044-23456789</phone>

<flag gender="F"/>

</contact>

<contact type="receiver">

<name>bbbb</name>

<address1>dfdsgdsgdsfvg</address1>

<address2>fvgefgffdg</address2>

<city>chennai</city>

<state>tamilnadu</state>

<zip>600089</zip>

<phone>044-23456789</phone>

<flag gender="F"/>

</contact>

<salutation>Dear Sir: </salutation>

<paragraph>It is our privillege .........</paragraph>

<closing>Sincerely</closing>

<signature>Ms.aaaaa</signature>

</letter>

Page 62: Cs9228 Web Technology Lab Manual

Letter.dtd:

<!element letter(contact+, salutation, paragraph+, closing, signature)>

<element contact(name, address1, address2, city, state, zip, phone, flag)>

<!attlist contacttype CDATA #implied>

<!element address1(#PCDATA)>

<!element address2(#PCDATA)>

<!element city(#PCDATA)>

<!element state(#PCDATA)>

<!element zip(#PCDATA)>

<!element phone(#PCDATA)>

<!element flag EMPTY>

<!attlist flag gender(M/F)"M">

<!element salutation(#pcdata)>

<!element closing (#pcdata)>

<!element paragraph (#pcdata)>

<!element signature (#pcdata)>

Page 63: Cs9228 Web Technology Lab Manual

Output:

RESULT:

Thus the program for writing DTD or XML schema for the domain

specific XML document has been successfully completed.

Page 64: Cs9228 Web Technology Lab Manual

PARSING AN XML DOCUMENT USING DOM AND SAX PARSERS.

AIM:

To Parsing an XML document using DOM and SAX Parsers.

ALGORITHM :

Using Dom:

Step1: Get a document builder using document builder factory and

parse the xml file to create a DOM object

Step 2: Get a list of employee elements from the DOM

Step3: For each employee element get the id, name, age and type.

Create an employee value object and add it to the list.

Step4: At the end iterate through the list and print the employees to

verify we parsed it right.

Using Sax

Step1: Create a Sax parser and parse the xml

Step2: In the event handler create the employee object

Step3 : Print out the data

Page 65: Cs9228 Web Technology Lab Manual

Coding

employees.xml

<?xml version="1.0" encoding="UTF-8"?>

<Personnel>

<Employee type="permanent">

<Name>Seagull</Name>

<Id>3674</Id>

<Age>34</Age>

</Employee>

<Employee type="contract">

<Name>Robin</Name>

<Id>3675</Id>

<Age>25</Age>

</Employee>

<Employee type="permanent">

<Name>Crow</Name>

<Id>3676</Id>

Page 66: Cs9228 Web Technology Lab Manual

<Age>28</Age>

</Employee>

</Personnel>

Using DOM

DomParserExample.java

a) Getting a document builder

private void parseXmlFile(){

//get the factory

DocumentBuilderFactory dbf =

DocumentBuilderFactory.newInstance();

try {

//Using factory get an instance of document builder

DocumentBuilder db = dbf.newDocumentBuilder();

//parse using builder to get DOM representation of the

XML file

Page 67: Cs9228 Web Technology Lab Manual

dom = db.parse("employees.xml");

}catch(ParserConfigurationException pce) {

pce.printStackTrace();

}catch(SAXException se) {

se.printStackTrace();

}catch(IOException ioe) {

ioe.printStackTrace();

}

}

b) Get a list of employee elements

Get the rootElement from the DOM object.From the root element get all

employee elements. Iterate through each employee element to load the data.

private void parseDocument(){

//get the root element

Element docEle = dom.getDocumentElement();

//get a nodelist of

elements

Page 68: Cs9228 Web Technology Lab Manual

NodeList nl = docEle.getElementsByTagName("Employee");

if(nl != null && nl.getLength() > 0) {

for(int i = 0 ; i < nl.getLength();i++) {

//get the employee element

Element el = (Element)nl.item(i);

//get the Employee object

Employee e = getEmployee(el);

//add it to list

myEmpls.add(e);

}

}

}

c) Reading in data from each employee.

/**

* I take an employee element and read the values in, create

* an Employee object and return it

Page 69: Cs9228 Web Technology Lab Manual

*/

private Employee getEmployee(Element empEl) {

//for each <employee> element get text or int values of

//name ,id, age and name

String name = getTextValue(empEl,"Name");

int id = getIntValue(empEl,"Id");

int age = getIntValue(empEl,"Age");

String type = empEl.getAttribute("type");

//Create a new Employee with the value read from the xml

nodes

Employee e = new Employee(name,id,age,type);

return e;

}

/**

Page 70: Cs9228 Web Technology Lab Manual

* I take a xml element and the tag name, look for the tag and get

* the text content

* i.e for <employee><name>John</name></employee> xml snippet if

* the Element points to employee node and tagName is 'name' I will

return John

*/

private String getTextValue(Element ele, String tagName) {

String textVal = null;

NodeList nl = ele.getElementsByTagName(tagName);

if(nl != null && nl.getLength() > 0) {

Element el = (Element)nl.item(0);

textVal = el.getFirstChild().getNodeValue();

}

return textVal;

}

Page 71: Cs9228 Web Technology Lab Manual

/**

* Calls getTextValue and returns a int value

*/

private int getIntValue(Element ele, String tagName) {

//in production application you would catch the exception

return Integer.parseInt(getTextValue(ele,tagName));

}

d) Iterating and printing.

private void printData(){

System.out.println("No of Employees '" + myEmpls.size() +

"'.");

Iterator it = myEmpls.iterator();

while(it.hasNext()) {

System.out.println(it.next().toString());

}

}

Page 72: Cs9228 Web Technology Lab Manual

Using Sax:

SAXParserExample.java

a) Create a Sax Parser and parse the xml

private void parseDocument() {

//get a factory

SAXParserFactory spf = SAXParserFactory.newInstance();

try {

//get a new instance of parser

SAXParser sp = spf.newSAXParser();

//parse the file and also register this class for call backs

sp.parse("employees.xml", this);

}catch(SAXException se) {

se.printStackTrace();

}catch(ParserConfigurationException pce) {

pce.printStackTrace();

Page 73: Cs9228 Web Technology Lab Manual

}catch (IOException ie) {

ie.printStackTrace();

}

}

b) In the event handlers create the Employee object and call the

corresponding setter methods.

//Event Handlers

public void startElement(String uri, String localName, String

qName,

Attributes attributes) throws SAXException {

//reset

tempVal = "";

if(qName.equalsIgnoreCase("Employee")) {

//create a new instance of employee

tempEmp = new Employee();

tempEmp.setType(attributes.getValue("type"));

}

Page 74: Cs9228 Web Technology Lab Manual

}

public void characters(char[] ch, int start, int length) throws

SAXException {

tempVal = new String(ch,start,length);

}

public void endElement(String uri, String localName,

String qName) throws SAXException {

if(qName.equalsIgnoreCase("Employee")) {

//add it to the list

myEmpls.add(tempEmp);

}else if (qName.equalsIgnoreCase("Name")) {

tempEmp.setName(tempVal);

}else if (qName.equalsIgnoreCase("Id")) {

tempEmp.setId(Integer.parseInt(tempVal));

}else if (qName.equalsIgnoreCase("Age")) {

Page 75: Cs9228 Web Technology Lab Manual

tempEmp.setAge(Integer.parseInt(tempVal));

}

}

c) Iterating and printing.

private void printData(){

System.out.println("No of Employees '" + myEmpls.size() +

"'.");

Iterator it = myEmpls.iterator();

while(it.hasNext()) {

System.out.println(it.next().toString());

}

}

Page 76: Cs9228 Web Technology Lab Manual

OUTPUT:

Employee Details - Name:Seagull, Type:permanent, Id:3674, Age:34.

Employee Details - Name:Robin, Type:contract, Id:3675, Age:25.

Employee Details - Name:Crow, Type:permanent, Id:3676, Age:28.

Result :

Thus the Parsing an XML document using DOM and SAX Parsers is

been done and executed successfully.

Page 77: Cs9228 Web Technology Lab Manual

CREATION OF WEB APPLICATION USING PHP

AIM:

To create a calculator web appliction using php.

ALGORITHM :

Step1 : Start the program

Step2 : Create a php web page calc.php

Step3: Using form and input type tag create various buttons, textbox,

radio button etc.

Step4: calcute the output for various option

Step5: using post method display the result in next page.

Step6: Stop the program.

Page 78: Cs9228 Web Technology Lab Manual

Coding:

Calc.php:

<?php

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Calculator</title>

</head>

<body>

<?php

// basic calculator program

function showForm() {

?>

All field are required, however, if you forget any, we will put a random

number in for you. <br />

<table border="0">

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">

<tr>

<td>Number:</td>

<td><input type="text" maxlength="3" name="number" size="4"

/></td>

</tr>

<span id="square">

<tr>

<td>Another number:</td>

<td><input type="text" maxlength="4" name="number2" size="4"

/></td>

</tr>

</span>

<tr>

<td valign="top">Operator:</td>

<td><input type="radio" name="opt" value="+" </>+<br />

<input type="radio" name="opt" value="-" />-<br />

<input type="radio" name="opt" value="*" />*<br />

Page 79: Cs9228 Web Technology Lab Manual

<input type="radio" name="opt" value="/" />/<br />

<input type="radio" name="opt" value="^2" />x<sup>2</sup><br />

<input type="radio" name="opt" value="sqrt" />sqrt<br />

<input type="radio" name="opt" value="^" />^<br />

</td>

</tr>

<tr>

<td>Rounding:</td>

<td><input type="text" name="rounding" value="4" size="4"

maxlength="4" /></td>

<td><small>(Enter how many digits you would like to round

to)</small>

</td>

</tr>

<tr>

<td><input type="submit" value="Calculate" name="submit" /></td>

</tr>

</form>

</table>

<?php

}

if (empty($_POST['submit'])) {

showForm();

} else {

$errors = array();

$error = false;

if (!is_numeric($_POST['number'])) {

(int)$_POST['number'] = rand(1,200);

}

if (empty($_POST['number'])) {

(int)$_POST['number'] = rand(1,200);

}

if (!is_numeric($_POST['number2'])) {

(int)$_POST['number2'] = rand(1,200);

}

if (empty($_POST['number2'])) {

Page 80: Cs9228 Web Technology Lab Manual

(int)$_POST['number2'] = rand(1,200);

}

if (empty($_POST['rounding'])) {

$round = 0;

}

if (!isset($_POST['opt'])) {

$errors[] = "You must select an operation.";

$error = true;

}

if (strpbrk($_POST['number'],"-") and strpbrk($_POST['number2'],"0.") and

$_POST['opt'] == "^") {

$errors[] = "You cannot raise a negative number to a decimal, this is

impossible. <a

href=\"http://hudzilla.org/phpwiki/index.php?title=Other_mathematical_conv

ersion_functions\">Why?</a>";

$error = true;

}

if ($error != false) {

echo "We found these errors:";

echo "<ul>";

foreach ($errors as $e) {

echo "<li>$e</li>";

}

echo "</ul>";

} else {

switch ($_POST['opt']) {

case "+":

$result = (int)strip_tags($_POST['number']) +

(int)strip_tags($_POST['number2']);

echo "The answer to " . (int)strip_tags($_POST['number']) . "

$_POST[opt] " . (int)strip_tags($_POST['number2']) . " is $result.";

break;

case "-";

$result = (int)strip_tags($_POST['number']) -

(int)strip_tags($_POST['number2']);

echo "The answer to " . (int)strip_tags($_POST['number']) . "

$_POST[opt] " . (int)strip_tags($_POST['number2']) . " is $result.";

break;

Page 81: Cs9228 Web Technology Lab Manual

case "*";

$result = (int)strip_tags($_POST['number']) *

(int)strip_tags($_POST['number2']);

echo "The answer to " . (int)strip_tags($_POST['number']) . "

$_POST[opt] " . (int)$_POST['number2'] . " is $result.";

break;

case "/";

$result = (int)strip_tags($_POST['number']) /

(int)strip_tags($_POST['number2']);

$a = ceil($result);

echo "<br />";

echo "<hr />";

echo "<h2>Rounding</h2>";

echo "$result rounded up is $a";

echo "<br />";

$b = floor($result);

echo "$result rounded down is $b";

echo "<br />";

$h = round($result,(int)$_POST['rounding']);

echo "$result rounded to $_POST[rounding] digits is " . $h;

break;

case "^2":

$result = (int)strip_tags($_POST['number']) *

(int)strip_tags($_POST['number2']);

$a = (int)$_POST['number2'] * (int)$_POST['number2'];

echo "The answer to " . (int)$_POST['number'] . "<sup>2</sup> is

" . $result;

echo "<br />";

echo "The answer to " . (int)$_POST['number2'] . "<sup>2</sup>

is " . $a;

break;

case "sqrt":

$result = (int)strip_tags(sqrt($_POST['number']));

$sqrt2 = (int)strip_tags(sqrt($_POST['number2']));

echo "The square root of " . (int)strip_tags($_POST['number']) . " is "

. $result;

echo "<br />";

echo "The square root of " . (int)strip_tags($_POST['number2']) . "

is " . $sqrt2;

echo "<br />";

Page 82: Cs9228 Web Technology Lab Manual

echo "The square root of " . (int)strip_tags($_POST['number']) . "

rounded to " . strip_tags($_POST[rounding]) . " digits is " .

round($result,(int)$_POST['rounding']);

echo "<br />";

echo "The square root of " . (int)strip_tags($_POST['number2']) . "

rounded to " . strip_tags($_POST[rounding]) . " digits is " .

round($sqrt2,(int)strip_tags($_POST['rounding']));

break;

case "^":

$result =

(int)strip_tags(pow($_POST['number'],$_POST['number2']));

$pow2 =

(int)strip_tags(pow($_POST['number2'],$_POST['number']));

echo (int)$_POST['number'] . "<sup>" .

strip_tags($_POST[number2]) . "</sup> is " . $result;

echo "<br />";

echo (int)$_POST['number2'] . "<sup>" .

strip_tags($_POST[number]) . "</sup> is " . $pow2;

break;

}

}

}

echo "<br />";

?>

<a href="calc.php">Go Back</a>

</body>

</html>

Page 83: Cs9228 Web Technology Lab Manual

OUTPUT:

Page 84: Cs9228 Web Technology Lab Manual

Result:

Thus the calculator web appliction using php is been developed succesfully.

Page 85: Cs9228 Web Technology Lab Manual

CREATION OF WEB APPLICATION USING PHP

AIM:

To create a calculator web appliction using php.

ALGORITHM :

Step1: Start the program

Step2: Create a php web page contact.php

Step3: Using form and input type tag create various buttons, textbox,

radio

button etc.

Step4: Get the necessary field from the user.

Step5: Using post method display the result in next page.

Step6: Stop the program.

Page 86: Cs9228 Web Technology Lab Manual

Coding:

Contact.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Web and Crafts</title>

<meta name="keywords" content="" />

<meta name="description" content="" />

<link href="style.css" rel="stylesheet" type="text/css" media="screen" />

</head>

<body><!-- #header-wrapper -->

<?php

$name = $_POST['name'];

$address = $_POST['address'];

$city = $_POST['city'];

$zip = $_POST['zip'];

$phonenumber = $_POST['phonenumber'];

$email = $_POST['email'];

$message = $_POST['message'];

$error=0;

if (isset($_POST['submit'])) {

if (eregi('http:', $notes)) {

die ("Do NOT try that! ! ");

}

if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))

{

echo "<h2>Use Back - Enter valid e-mail</h2>\n";

$badinput = "<h2>Feedback was NOT submitted</h2>\n";

echo $badinput;

Page 87: Cs9228 Web Technology Lab Manual

$error=1;

}

if(empty($name) || empty($phonenumber) || empty($email ) ||

empty($message)) {

echo "<h2>Use Back - fill in all required fields

</h2>\n"; $error=1; }

if($error!=1){

$todayis = date("l, F j, Y, g:i a") ; $attn =

$subject ;

$subject = "mail from $email";

$message = stripcslashes($message);

$mailmessage = " $todayis [EST]

\n Subject: $subject \n Message: $message \n From:

$name ($email)\n City: $city\n Pin/Zip code: $zip\n

PhoneNo: $phonenumber\n

"; $from ="From: $email \r\n";

mail("[email protected]" ,$subject,

$mailmessage,$from);

echo "Thank You :";

echo "$name(";

echo "$email )";

echo "for your interest in our services. We

will contact you soon <br>";

}

else

{

echo "Use Back and Fill all required fields !!";

}

}

else

{

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"

enctype="multipart/form-data" id="form1">

<table cellspacing="0" cellpadding="2" width="100%" border="0"

class="text_main">

<tr>

<td align="right" valign="center"><strong><font

color="#ff0000">*</font>&nbsp;Name : </strong></td>

<td align="left" valign="center"><input

style="WIDTH: 207px; HEIGHT: 22px" size="26" name="name"

/></td>

Page 88: Cs9228 Web Technology Lab Manual

</tr>

<tr>

<td align="right" valign="center"><strong>Address :</strong></td>

<td align="left" valign="center"><textarea style="WIDTH: 205px;

HEIGHT: 80px" name="address" rows="6" cols="22"></textarea></td>

</tr>

<tr>

<td align="right" valign="center"><strong>City :</strong></td>

<td align="left" valign="center"><input

style="WIDTH: 205px; HEIGHT: 22px" size="26" name="city" /></td>

</tr>

<tr>

<td align="right" valign="center"><strong><font

color="#ff0000">*</font>&nbsp;Phone No :</strong></td>

<td align="left" valign="center"><input

style="WIDTH: 168px; HEIGHT: 22px" size="21"

name="phonenumber" /></td>

</tr>

<tr>

<td align="right" valign="center"><strong><font

color="#ff0000">*</font>&nbsp;Email :</strong></td>

<td align="left" valign="center"><input

style="WIDTH: 207px; HEIGHT: 22px" size="26" name="email"

/></td>

</tr>

<tr>

<td align="right" valign="center"><strong><font

color="#ff0000">*</font>&nbsp;Your Message :</strong></td>

<td align="left" valign="center"><textarea style="WIDTH: 346px;

HEIGHT: 158px" name="message" rows="8" cols="37"></textarea></td>

</tr>

<tr>

<td valign="center" align="right"></td>

<td valign="center" align="left"><input type="submit" value="Send"

name="submit" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type="reset" value="Clear" name="reset" /></td>

</tr>

<tr>

<td valign="center" align="right"></td>

<td valign="center" align="left" height="15"

></td>

Page 89: Cs9228 Web Technology Lab Manual

</tr>

<tr>

<td align="right" valign="center"></td>

<td align="left" valign="center">Fields

marked <font color="#ff0000">*</font> are

mandatory</td>

</tr>

</table>

</form>

<?php

}

?>

</body>

</html>

Page 90: Cs9228 Web Technology Lab Manual

Sample output:

RESULT:

Thus the Php application has been developed and executed

successfully.