Web Essential Lab Record
Web Essential Lab Record
S. Page
No. Date Experiment Title Sign.
No.
1 HTML PROGRAM AND HOT SPOTS IMPLEMENTATION
2 CREATING A WEBSITE WITH CSS
3 DESIGN AN INTERACTIVE WEB SITE
4 ADDING TWO NUMBERS USING JAVA SCRIPT
5 COMPARING TWO NUMBERS USING JAVA SCRIPT
6 FORM VALIDATION USING JAVA SCRIPT
7 XAMPP SERVER
8 GREETING TEXT USING PHP
9 PALINDROME CHECKING USING PHP
10 ARMSTRONG NUMBER CHECKING USING PHP
11 FACTORIAL VALUE USING PHP RECURSIVE FUNCTION
12 READ FROM EXISTING FILE USING PHP
13 WRITE A NEW FILE USING PHP
14 HIT COUNTER USING COOKIES
15 LOGIN PAGE USING SESSION
16 HANDLING MULTIMEDIA CONTENT USING PHP
17 LOGIN WITH SQL CONNECTION USING PHP
18 APACHE TOMCAT SERVER
19 INVOKING SERVLET FROM HTML
20 DISPLAY PERSONAL INFORMATION
<Register Number>
AIM:
PROCEDURE:
Step 3: Download proper images and embed an image map in that page (home.html)
Step 4: Link the hot spots either with html files or image files
hotspot.html:
<!DOCTYPE html>
<html>
<body>
<map name="planetmap">
<area shape="rect" coords="0,0,150,150" alt="Sun" href="sun.html">
<area shape="circle" coords="190,75,10" alt="Mercury" href="mercur.html">
</map>
</body>
</html>
<Register Number>
sun.html:
<!DOCTYPE html>
<html>
<body>
<p>Closer look of Sun: </p>
</body>
</html>
mercur.html:
<!DOCTYPE html>
<html>
<body>
<h1>Information about Mercury: </h1>
<p>
<b>Mercury </b>is the smallest planet in the Solar System and the closest to the Sun. Its orbit
around the Sun takes 87.97 Earth days, the shortest of all the Sun's planets.
</p>
</body>
</html>
OUTPUT:
<Register Number>
RESULT:
3.
<Register Number>
AIM:
PROCEDURE:
Step 2: Declare the property of cascading style sheets and saved as filename is
external.css
Step 3: Open a new HTML document and type the html program.
Step 4: Similarly open the html file for Internal.html, inline .html.
external.css:
body{background-color:green;}
p{color:blue;}
h3{color:white;}
ul.a {list-style-type: square;}
ul.b {list-style-type: circle;}
ol.c{list-style-type:upper-roman;}
ol.d{list-style-type:lower-alpha;}
#hi{text-color:white;}<!--Id Selector-->
body{background-image:url('tamilnadu.jpg');}
h1{text-align:center;}<!--Type Selector-->
p.date{text-align:right;}<!--Desendent Selector-->
<Register Number>
EXTERNAL.HTML
<html>
<head>
<link rel="stylesheet" type="text/css" href="external.css"/><!-- Links External Style Sheet ext.css-->
</head>
<body>
<h1>EXTERNAL STYLE SHEET</h1>
<h3>a white header</h3>
<ul class="b">
<li>liststyletype-circle</li>
<li>liststyletype-circle</li>
<li>liststyletype-circle</li>
</ul>
<ol class="c">
<li>upper-roman</li>
<li>upper-roman</li>
</ol>
<ol class="d">
<li>lower_alpha</li>
<li>lower_alpha</li>
</ol>
<p class="date">
This paragraph has a blue font .the back ground colour is green because of external style sheet</p>
</body>
</html>
INTERNAL.HTML
<html>
<head>
<style>
body{background-color:grey;}
p{color:white;}
ul.a {list-style-type: circle;}
ul.b {list-style-type: square;}
#p1{font-family:"Times New Roman",Times,serif;}
</style>
<Register Number>
</head>
<body><!--Type Selector-->
<center>
<h2>INTERNAL STYLE SHEET</h2>
</center>
<ul class="b"><!--Desendent Selector Element ul followed by class (.b)-->
<li>liststyletype:square</li>
<li>liststyletype:square</li>
</ul>
<p id="p1">This page USES internal css using style tag</p><!-- ID Selector-->
</body>
</html>
INLINE.HTML
<html>
<head>
<title>inline css</title>
</head>
<BODY style="background-color:red";><!-- INLINE Stylesheet style keyword as an attribute-->
<center>
<h2>INLINE STYLE SHEET</h2>
</center>
<p style="color:blue;margin-left:20px"><!-- INLINE Stylesheet style keyword as an attribute-->
This page uses inline css using style attribute<BR/>Inline Style Sheet has the highest priority amomg
all style sheets<BR/>Text color is blue and margin left width is 20px.
</p>
</body>
</html>
<Register Number>
OUTPUT:
RESULT:
The creation of web page using Cascading style sheet is successfully executed.
4.
<Register Number>
AIM:
To create a client side scripts for validating web form controls using DHTML.
PROCEDURE:
Step 2: Add the image source and frameset syntax in the DHTML code.
Step 3: Using window.alert() function to be display the form validation output in the client
side scripting.
Step 4: Similarly open the DHTML file signup, frames, form, registration and response
Signup.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<center>
<imgsrc="Penguins.jpg" alt="image1" width="20%" height="15%" />
<h1>
Welcome to my website!!!
</h1>
Please <b><i><abbr title="Sign Up for Form registration" ><a
href="Frames.html">Sign <sup>up</sup></a></abbr></i></b> here
</center>
<Register Number>
</body>
</html>
Frames.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<frameset cols="35,35" rows="*">
<frame id="fr1" src="Form.html" NAME="Left frame" >
<frame id="fr2" src="Default.html" NAME="Right frame" >
</frameset><noframes></noframes>
</html>
Form.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=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function check()
{
var name1=document.getElementById("uname").value;
if(name1.length<1)
{
window.alert("Field should be filled");
f1=0;
}
var re=new RegExp("^[0-9]");
if(re.test(name1))
<Register Number>
{
window.alert("User name should not start with a digit");
f1=0;
}
}
function check1()
{
var name1=document.getElementById("passwd").value;
if(name1.length<1)
{
window.alert("Field should be filled");
f1=0;
}
}
function check2()
{
var name2=document.getElementById("c_passwd").value;
var name1=document.getElementById("passwd").value;
if(name2.length<1)
{
window.alert("Field should be filled");
f1=0;
}
if(name1!=name2)
{
window.alert("Password mismatch");
f1=0;
}
}
</script>
</head>
<body>
<center>
<h2>
<Register Number>
Form Registration</h2>
<form name="f1" ACTION="Response.html" target = "Right frame">
<table border=1>
<tr>
<td>UserName</td>
<td><input type="text" id="uname" name="name" placeholder="your name*" onblur="check()"
/></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" id="passwd" placeholder="Enter password*"
onblur="check1()" />
</td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" id="c_passwd" placeholder="Confirm password*"
onblur="check2()" />
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" value="submit" />
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
<Register Number>
Default.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<h2>
Collecting Details...
</h2>
</body>
</html>
Response.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<h2>
Welcome
</h2>
<h2>
Registration Successful
</h2>
</body>
</html>
<Register Number>
OUTPUT:
RESULT:
The creation of client side scripts for validating web form controls using DHTML is successfully
executed.
<Register Number>
AIM:
To write a program to get two numbers and display the sum on the browser.
PROCEDURE:
Step 3: When window prompt you to enter the numbers, enter numbers.
PROGRAM:
HTML FILENAME: add.html
<html >
<head>
<title>ADD Program in JavaScript</title>
</script>
</head>
<body>
</body>
</html>
OUTPUT:
<Register Number>
RESULT:
The creation of program to get two numbers and display the sum on the browser is successfully
executed.
<Register Number>
AIM:
PROCEDURE:
Step 3: When window prompt you to enter the numbers, enter numbers.
PROGRAM:
HTML FILENAME: Compare.html
<html >
<head>
<title>Comparition Program in JavaScript</title>
</script>
</head>
<body>
</body>
</html>
OUTPUT:
<Register Number>
RESULT:
AIM:
PROCEDURE:
Step 3: Link the java script using <script type="text/javascript" src="script.js"> </script> in the html
file.
PROGRAM:
HTML FILENAME: form.html
<html>
<head>
<title>LOGIN PAGE </title>
</head>
<script type="text/javascript" src="script.js">
</script>
<body>
<h1 style="color:green">LOGIN PAGE</h1>
JS FILENAME: script.js
function validateForm() {
//collect form data in JavaScript variables
var pw1 = document.getElementById("pswd1").value;
var pw2 = document.getElementById("pswd2").value;
var name1 = document.getElementById("fname").value;
if(pw1 == "") {
document.getElementById("message1").innerHTML = "**Fill the password please!";
return false;
}
//check empty confirm password field
if(pw2 == "") {
document.getElementById("message2").innerHTML = "**ReEnter the password please!";
return false;
}
//minimum password length validation
if(pw1.length < 8) {
document.getElementById("message1").innerHTML = "**Password length must be atleast 8
characters";
return false;
}
//maximum length of password validation
if(pw1.length > 15) {
document.getElementById("message1").innerHTML = "**Password length must not exceed 15
characters";
return false;
}
if(pw1 != pw2) {
document.getElementById("message2").innerHTML = "**Passwords are not same";
return false;
} else {
alert ("Your password created successfully");
document.write("your login has been successfully done");
}
}
<Register Number>
OUTPUT:
<Register Number>
RESULT:
The creation of program to validate the html forms using java script is successfully executed.
8.
<Register Number>
XAMPP SERVER
(https://www.apachefriends.org/download.html)
3. You are given the option to install the Apache server and the MySQL database server as
services. If you install the Apache Server and MySQL as services, you will not have to start
them manually through the XAMP Control Panel. Note that you have the option to install or
uninstall these services in the XAMPP Control Panel.
4. If you are using the self-extracting archive, after the archive is extracted, run the file setup-
xampp.bat to configure the components of the package. (The XAMPP installer runs this file
automatically.)
5. After configuration, open the XAMP Control Panel. (You can open it manually by running
the file XAMPP_HOME/xampp-control.exe or from the Xampp Control Panel icon that is
automatically placed on your desktop.) When you open the XAMPP Control Panel, note that
the modules that are installed as services are already running.
Checking XAMPP Installation
Run your browser and enter the following URL: http://localhost. The XAMPP welcome page opens:
<Register Number>
RESULT:
AIM:
To write a program for get the name of the user from a form and show greeting text.
PROCEDURE:
PROGRAM:
HTML FILENAME: greet.html
<html>
<head><style type="text/css">
div {font-size:20pt;color:green;font-family:Jokerman;text-align:center;width:30%}
p{font-size:18pt;color:darkblue;font-weight:bold;align:center;font-family:arial black}
.double{border-style:double}
.dashed{border-style:dashed}
</style></head><body><center><br><br>
<div class="double">GREETING TEXT</div><br>
<div class="dashed"><form action="gre.php" method="post">
<p>Enter The Text:<br><input type="text" name="n"></p><br>
<input type="submit" value=" SUBMIT ">
<br></div></center></form></body></html>
PHP FILENAME: gre.php
<?php
$n1=$_POST['n'];
echo'<p><img src="4c.gif" alt="flower" style="float:right;">';
echo'<center><font color="green" face="arial" size="6">WELCOME</font>';
echo ‘<center><b> $n1 </b><font color="green">!!!</font></center>';
?>
OUTPUT:
<Register Number>
RESULT:
The PHP program for get the name of the user from a form and show greeting text is tested
successfully.
10.
<Register Number>
AIM:
PROCEDURE:
PROGRAM:
HTML FILENAME: palindrome.php
<html>
<body>
<form action="" method="post">
<br><center><h1><u><font color="red">PALINDROME</font></u></h1></center>
<br><table bgcolor="forestgreen" align="center">
<tr><td><br><input type="text" value=" Enter the Input" readonly>
<input type="text" name="n"></tr></td>
<tr><td><br><br><center><br><br>
<input type="submit" value=" SUBMIT ">
<br><br><br></center></tr></td></table>
</form>
<?php
if($_POST)
{
$n1=$_POST["n"];
$p=$n1;
$s=0;
while($n1>=1)
{
$r=$n1%10;
$n1=$n1*(10/100);
$s=$s*10+$r;
}
echo '<table align="center" border="2" width="46%"><tr align="center"><td><br>';
<Register Number>
OUTPUT:
<Register Number>
RESULT:
AIM:
PROCEDURE:
PROGRAM:
HTML FILENAME: armstrong.php
<html>
<body>
<form action="" method="post">
<br><center><h1><u>ARMSTRONG</u></h1></center>
<br><table bgcolor="Crimson" align="center">
<tr><td><br><input type="text" value=" Enter the Input" readonly>
<input type="text" name="n"></tr></td>
<tr><td><br><br><center><br><br>
<input type="submit" value=" SUBMIT ">
<br><br><br></center></tr></td></table>
</form>
<?php
if($_POST)
{
$n1=$_POST["n"];
$m=$n1;
$s=0;
while($n1>0)
{
$r=$n1%10;
$n1=$n1/10;
$s=$s+($r*$r*$r);
<Register Number>
}
echo '<table align="center" border="2" width="38%"><tr align="center"><td><br>';
echo '<font color="Crimson">';
if($m==$s)
echo"<h2> $m is Armstrong Number</h2>";
else
echo"<h2> $m is not Armstrong Number</h2>";
}
echo'</font>';
echo'</td></tr></table>';
?>
</body>
</html>
OUTPUT:
<Register Number>
RESULT:
The PHP program for find the given number is Armstrong or not is tested successfully.
12.
<Register Number>
AIM:
PROCEDURE:
PROGRAM:
HTML FILENAME: fact.html
<html>
<body bgcolor="darkkhaki">
<form action="factorial.php" method="post">
<center><br><br><br><br><br><br>
<table align="center" border="2" width="30%">
<tr align="center" bgcolor="darkblue"><td><font
color="white"><br><h1>FACTORIAL</h1></td></tr>
<tr bgcolor="chocolate"><td><br><br><br>
<font face="arial" size="6" color="white">Enter the Digit:</font>
<input type="text" name="n" size="15">
<br><br><br> &nb
sp;
&nb
sp;
<input type="submit" value=" SEND "><br><br><br>
</td></tr></table>
</center>
</form>
</html>
PHP FILENAME: factorial.php
<?php
<Register Number>
$m=$_POST["n"];
function factorial($m)
{
if($m<2)
return 1;
else
return($m*factorial($m-1));
}
$f=factorial($m);
echo'<br><table border="2" align="center"><tr><td>';
echo'<center><font face="arial" size="15" color="crimson">FACTORIAL</font><br><br>';
echo"<b>-------------------------------------------------------------</b>";
echo'<font face="arial" size="10"><br>';
echo"Given Digit = $m <br>";
echo'<br><font color="green">';
echo "Factorial = $f";
echo"</center></font>";
echo'</td></tr></table>';
?>
OUTPUT:
<Register Number>
RESULT:
The PHP program for display factorial value using Recursive Function is tested successfully.
13.
<Register Number>
AIM:
PROCEDURE:
PROGRAM:
HTML FILENAME: read.php
<html>
<body>
<form method="post">
<table align="center">
<font color="deeppink"><h1><u>READ THE FILE</u></h1></font>
<tr><td><b>Enter Your File Name :</b></td><td><input type="text"
name="file"></td></tr><br>
<tr><td><b>Choose File Extension :</b></td><br>
<td><select name="ext">
<option>.txt</option>
<option>.doc</option>
<option>.pdf</option>
</select></td></tr><br>
<tr><td><b>Content Of The File:</b></td><td><textarea rows="10" cols="16" name="data">
<?php echo @$contents;?></textarea></td></tr>
<tr colspan=2 align="center"><td>
<input type="submit" value="DISPLAY" name="disp">
</td></tr></table></form></body></html>
<?php
if(isset($_POST['disp']))
{
$f=$_POST['file'];
$ext=$_POST['ext'];
$data=$_POST['data'];
<Register Number>
$file=$f.$ext;
if(file_exists($file))
{
$fo=fopen($file,"r");
$contents=fread($fo,filesize($file));
}
else
{
echo'<font color="deeppink" face="arial black"><center>File Not Exits</center></font>';
}
}
?>
OUTPUT:
<Register Number>
RESULT:
The PHP program for reading content from existing file is tested successfully.
14.
<Register Number>
AIM:
PROCEDURE:
PROGRAM:
HTML FILENAME: write.php
<html>
<body>
<form method="post">
<table align="center">
<font color="deeppink"><h1><u>WRITE THE FILE</u></h1></font>
<tr><td><b>Enter Your File Name :</b></td><td><input type="text" name="file"></td></tr><br>
<tr><td><b>Choose File Extension :</b></td>
<td><select name="ext">
<option>.txt</option>
<option>.doc</option>
<option>.pdf</option>
</select></td></tr><br>
<tr><td><b>Write Content of File :</b></td><td><textarea rows="10" cols="16" name="data">
<?php echo @$contents;?></textarea></td><br>
<tr colspan="2" align="center"><td><input type="submit" value=" SAVE " name="disp">
</td></tr></table></form></body></html>
<?php
$f=$_POST['file'];
$ext=$_POST['ext'];
$data=$_POST['data'];
$file=$f.$ext;
if(file_exists($file))
{
echo'<font color="green" face="arial black"><center>Your File Already Exists</center></font>';
}
else
<Register Number>
{
$fo=fopen($file,"w");
fwrite($fo,$data);
echo'<font color="deeppink" face="arial black"><center>Your Data is Saved</center></font>';
}
?>
OUTPUT:
<Register Number>
RESULT:
The PHP program for writing contents into a new file is tested successfully.
<Register Number>
AIM:
To write a PHP program for counting the visiting page using cookie.
PROCEDURE:
PROGRAM:
HTML FILENAME: cook.php
<?php
if (!isset($_COOKIE['visits'])) $_COOKIE['visits'] = 0;
$visits = $_COOKIE['visits'] + 1;
setcookie('visits',$visits,time()+3600*24*365);
?>
<html>
<head><style type="text/css">
div {font-size:20pt;color:navy;font-family:arial black; width:50%;background-color:white}
p{font-size:18pt;color:lime;font-weight:bold;text-align:center;font-family:bauhus 93}
.groove{border-style:groove}
.dotted{border-style:dotted}
</style></head><body bgcolor="salmon">
<?php
echo'<br><br><center><div class="groove">HIT COUNTER USING COOKIES</div><br>';
echo'<div class="dotted">';
if ($visits > 1) {
echo "<p>This is visit number $visits</p>";}
else {
echo'<p>Welcome to my Website! Click here for a tour!</p>';
}echo"<br></center></div>";
?></body></html>
OUTPUT:
<Register Number>
RESULT:
The PHP program for counting the visiting page using cookie is tested successfully.
<Register Number>
16.
<Register Number>
AIM:
PROCEDURE:
PROGRAM:
LOGOUT.PHP
<?php
header('location:des.php');
?>
DES.PHP
<?php
session_start();
if(@$_POST['submit1'])
{
$u = $_POST['text1'];
$p = $_POST['pwd'];
if($u =="[email protected]" && $p=="nithya@1986")
{
$_SESSION['luser'] = $u;
$_SESSION['start'] = time();
// taking now logged in time
$_SESSION['expire'] = $_SESSION['start'] + (1*60) ;
// ending a session in 1 minutes from the starting time
header('Location: home.php');
}
else
{
$err= "<font color='red'>Invalid user login </font>";
}
}
?>
<html>
<head>
<title>Destroy Session after 1 minutes - Phptpoint.com</title>
</head>
<body>
<form name="form1" method="post">
<table align="center">
<Register Number>
<tr>
<Td colspan="2"><?php echo @$err;?></Td>
</tr>
<tr>
<td>Username </td>
<td><input type="email" name="text1" placeholder="[email protected]" required>
</td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pwd" placeholder="nithya@1986" required></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="SignIn" name="submit1">
</td> </tr>
</table>
</form>
</body>
</html>
HOME.PHP
<?php
session_start();
if(!isset($_SESSION['luser']))
{
echo "<p align='center'>Please Login again ";
echo "<a href='des.php'>Click Here to Login</a></p>";
}
else
{
$now = time();
// checking the time now when home page starts
if($now > $_SESSION['expire'])
{
session_destroy();
echo "<p align='center'>Your session has expire ! <a href='login.php'>Login Here</a></p>";
}
else
{
?>
<html>
<head>
<title>Destroy Session after 1 minutes - Phptpoint.com</title>
</head>
<body>
<p style="background:#CCCCCC">
Welcome <?php echo $_SESSION['luser']; ?>
<span style="float:right"><a href='logout.php'>LogOut</a></span>
<p style="padding-top:20px;background:#CCCCCC; height:400px; text-align:center">
<span style="color:red;text-align:center">Your Session Will destroy after 1 minutes You will
redirected on next page</span>
<br/><br/>
<span>if you want to logout before 1minutes click on logout link </span>
<Register Number>
</p>
</p>
<?php>}
?>
</body>
</html>
OUTPUT:
DESTROY SESSION
RESULT:
The PHP program for login page using session is tested successfully.
<Register Number>
17.
<Register Number>
AIM:
PROCEDURE:
PROGRAM:
HTML FILENAME: multimedia.html
<html>
<head>
<title>Video demo</title>
</head>
<body>
<audio controls>
</body>
</html>
OUTPUT:
<Register Number>
RESULT:
18.
<Register Number>
AIM:
PROCEDURE:
Step 1: Start apache server and mysql server from XAMPP control panel.
Step 5: Create php script to connect with database and validate username and password (sql.php)
PROGRAM:
HTML FILENAME: db.html
<html>
<body>
<form action="sql.php" method="post">
<br><center><table border=2" bordercolor="red">
<tr><td><table><tr font face="white">
<th colspan="2" bgcolor="crimson" align="center">
<h3>LOGIN FORM</th></tr>
<tr><th align="left">UserName</th>
<td><input type="text" name="u"></td></tr>
<tr><th align="left">Password</th>
<td><input type="password" name="p"></td></tr>
<tr align="center"><br><td><input type="submit" value=" LOGIN "></td>
<td><input type="reset" value=" CLEAR "></td></tr>
</table></td></tr></table>
</center></form></body></html>
$res=mysqli_query($db,$query) or die(mysql_error());
$rows = mysqli_num_rows($res);
if($rows==1){
?>
OUTPUT:
<Register Number>
RESULT:
The PHP program for login page with SQL connection is tested successfully.
19.
<Register Number>
3. Set the JAVA_HOME environment variable. Set to your JDK installation directory, e.g., "c:\
Program Files\java\jdk1.6.0_xx". JAVA_HOME is needed for running Tomcat and many
other Java applications.
Since servlets and JSP are not part of the Java 2 platform, standard edition, you have to
identify the servlet classes to the compiler. The server already knows about the servlet
classes, but the compiler (i.e., javac) you use for development probably doesn't. So, if you
don't set your CLASSPATH, attempts to compile servlets, tag libraries, filters, Web app
listeners, or other classes that use the servlet and JSP APIs will fail with error messages
about unknown classes. Here are the standard Tomcat locations:
install_dir/common/lib/servlet-api.jar
install_dir/common/lib/jsp-api.jar
(eg: install_dir = C:\apache-tomcat-7.0.35)
6. The directory structure of install_dir has subdirectories like bin, webapps, common and other
subdirectories. The bin directory contains the two important batch files startup and
shutdown. The startup batch file is used to start and run the TOMCATServer. The shutdown
batch file is used to shutdown the TOMCAT server.
Running JSP/Servlets
1. The WEB.xml file should contain the following tags to run a servlet:
<servlet><servlet-name>yourservletname</servlet-name><servlet-
class>yourservletname</servlet-class>
</servlet><servlet-
mapping>
<servlet-name>yourservletname</servlet-name><url-
pattern>/servlet/ yourservletname</url-pattern>
</servlet-mapping>
20.
<Register Number>
AIM:
To create a program in java using servlets to invoke servlets from HTML forms and session
tracking.
PROCEDURE:
Step 1: Open a NetBeans IDE 8.0 and create a new project in java.
Step 4: create a new servlet file from your project and source package generated the new servlet file.
<Register Number>
Step 5: Assign the name for servlet file and save it.
Step 8: Finally run the html program and servlets using chrome browser with support of
localhost.
PROGRAM:
<!--ciform.html-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CompoundInterest</title>
</head>
<body style="background-color:khaki">
<h1>CompoundInterest</h1>
<Register Number>
/*InterestServlet.java*/
import java.io.*;
importjava.util.*;
importjavax.servlet.*;
importjavax.servlet.http.*;
public class InterestServlet extends HttpServlet
{
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throwsServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
int p=Integer.parseInt(request.getParameter("p1"));
int n=Integer.parseInt(request.getParameter("n1"));
double r=Double.parseDouble(request.getParameter("r1"));
PrintWriter out = response.getWriter();
double ci=p*(Math.pow(1+(r/100),n)-1);
try
{
out.println("<html>");
out.println("<head>");
out.println("<title>Compound Interest Servlet</title>");
out.println("</head>");
out.println("<body style=\"background-color:khaki\">");
out.println("<h1>Compound Interest</h1></hr>");
out.println("<table border=\"1\">");
out.println("<tr><td>Principal
Amount</td><td>"+p+"</td></tr>");
out.println("<tr><td>Deposit
Term</td><td>"+n+"</td></tr>");
out.println("<tr><td>Rate of
<Register Number>
Interest</td><td>"+r+"</td></tr>");
out.println("</table>");
out.println("<hr/>Compund Interest Amount:"+ci);
out.println("</body>");
out.println("</html>");
}
finally
{
out.close();
}
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throwsServletException, IOException
{
doGet(request,response);
}
}
/*web.xml*/
<servlet>
<servlet-name>InterestServlet</servlet-name>
<servlet-class>InterestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>InterestServlet</servlet-name>
<url-pattern>/servlet/InterestServlet</url-pattern>
</servlet-mapping>
OUTPUT:
<Register Number>
RESULT:
The program in java using servlets to invoke servlets from HTML forms and session tracking is
successfully executed.
<Register Number>
AIM:
To a write program for display our personal information using various tags.
PROCEDURE:
PROGRAM:
HTML FILENAME: personal.html
<html>
<body text="red" bgcolor="orange"><table align="center" bgcolor="white"><tr><td>
<center><h1><hr><hr>** PERSONAL DETAILS **<hr><hr></h1></center>
<font color="blue"><pre><h3> NAME - <b><font face="Courier">Riya</font>
D.O.B - <b><font face="Courier">Sep 10,1995</font>
BLOOD GROUP - <b><font face="Courier">A+</font>
ADDRESS - <b><font face="Courier">Kenikarai</font>
CONTACT NO - <b><font face="Courier">04567-220023</font>
EMAIL ID - <b><font face="Courier">[email protected]</font></font>
<font color="deeppink"><center><hr><hr><h1> ** MY FAVOURITES **</h1></center>
<hr><hr><font color="green"> FRIEND : <b><font face="Courier"> Akila</font>
FOOD : <b><font face="Courier"> Idly</font>
COLOUR : <b><font face="Courier">Blue & Pink</font>
PLACE : <b><font face="Courier">USA</font>
SPORTS : <b><font face="Courier"> Football</font>
DIRECTOR : <b><font face="Courier">Gowtham vasudev menan</font>
BOOK : <b><font face="Courier">The MONK Who Sold His FERRARI</font>
MOVIE : <b><font face="Courier">Ok Ok</font>
HOBBIES : <b><font face="Courier">Drawing </font>
</font></pre></h3></td></tr></table>
</body></html>
OUTPUT:
<Register Number>
RESULT:
The PHP program for display our personal information using various tags is tested successfully.