64
EXTERNAL STYLE SHEET PROGRAM: <html> <head> <title>External css</title> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <p> WELCOME TO PUDUCHERRY TRANSPORT CORPORATION </p> AVAILABLE MODES OF TRANSPORT <ol> <li>Roadways</li> <li>Railways</li> <li>Airways</li> <li>Waterways</li> </body> </html> mystyle.css h1{color:#CC66FF; font-style:italic; font-stretch:extra-expanded; background-attachment:fixed; background-repeat:repeat-x; font- family:Georgia, "Times New Roman", Times, serif} body{background-color:#FFFFCC;} body dd{ background-color:#cccccc; font-family:"Comic Sans MS"; font- size:18px; font-weight:bolder; font-style:italic; color:#0000FF} body dl{ font-family:"Comic Sans MS"; font-size:16px}

Pgms for Record

Embed Size (px)

DESCRIPTION

fd

Citation preview

Page 1: Pgms for Record

EXTERNAL STYLE SHEET

PROGRAM:

<html><head><title>External css</title><link rel="stylesheet" type="text/css" href="mystyle.css"></head>

<body><p>WELCOME TO PUDUCHERRY TRANSPORT CORPORATION</p>AVAILABLE MODES OF TRANSPORT<ol><li>Roadways</li><li>Railways</li><li>Airways</li><li>Waterways</li></body></html>

mystyle.css

h1{color:#CC66FF; font-style:italic; font-stretch:extra-expanded; background-attachment:fixed; background-repeat:repeat-x; font-family:Georgia, "Times New Roman", Times, serif}body{background-color:#FFFFCC;}body dd{ background-color:#cccccc; font-family:"Comic Sans MS"; font-size:18px; font-weight:bolder; font-style:italic; color:#0000FF}body dl{ font-family:"Comic Sans MS"; font-size:16px}

Page 2: Pgms for Record

OUTPUT:

Page 3: Pgms for Record

INTERNAL STYLE SHEET

PROGRAM:

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

<title>Internal style sheet</title><style>h1{color:#CC66FF; font-stretch:extra-expanded; background-attachment:fixed; background-repeat:repeat-x;}body{background-color:#FFFFCC;}body dd{ background-color:#cccccc; font-family:"Comic Sans MS"; font-size:18px; font-weight:bolder; font-style:italic; color:#0000FF}body dl{ font-family:"Comic Sans MS"; font-size:16px}</style></head>

<body><table width="1013" height="416"><tr><td colspan="6"><h1 align="center">SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE</h1><dl><br><br><dt>UNDER GRADUATE COURSES</dt><dd>Electrical & Electronics Engineering (EEE)</dd><dd>Electronics & Communication Engineering (ECE)</dd><dd>Computer Science & Engineering (CSE)</dd><dd>Information Technology (IT)</dd> <dd>Instrumentation & Control Engineering (ICE)</dd><dd>Mechanical Engineering (ME)</dd><dd>Civil Engineering (CE)</dd>

Page 4: Pgms for Record

<dt>POST GRADUATE COURSES</dt><dd>Master of Computer Applications </dd><dd>Master of Business Administration </dd></dl></td></tr></table>

</body></html>

OUTPUT:

Page 5: Pgms for Record

INLINE STYLE SHEET

PROGRAM:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Inline css</title></head><body><body bgcolor="#000000"><table style="font-family:Times New Roman, Times, serif; font-weight:bold; background-color: #FFFFFF" border="2"><tr><td>Sl.No</td><td>Name</td><td>Regno</td><td>Total Mark</td>

Page 6: Pgms for Record

<td>Rank</td></tr><tr><td>1</td></tr><tr><td>2</td></tr><tr><td>3</td></tr><tr><td>4</td></tr><tr><td>5</td></tr></table></body></html>

OUTPUT:

Page 7: Pgms for Record

IMPORTING A STYLE SHEET

PROGRAM:

style.cssol{font-style: bold}P{ font-size:20px; font-style:inherit;}ol li.light{

color:#666666;background-color:#F7F7F7;}

ol li.dark{color:#666666;background-color:#E8E8E8;

Page 8: Pgms for Record

}body{background-color:#99CCFF;color:#6633CC;}

Import.html

<html><head><title>import</title><style type="text/css">@import url("style.css");</style></head>

<body>

<p>WELCOME TO PUDUCHERRY TRANSPORT CORPORATION</p>AVAILABLE MODES OF TRANSPORT<ol><li class="light">Roadways</li><li class="dark">Railways</li><li class="light">Airways</li><li class="dark">Waterways</li> </ol></body></html>

OUTPUT:

Page 9: Pgms for Record
Page 10: Pgms for Record

FILTERING A STYLE SHEET

PROGRAM:

<html> <head><title>Filter</title></head> <body> <center> <h1 align=center>The Text is Turned </h1> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:flipV"> WELCOME TO CSE - FLIPV</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:flipH"> WELCOME TO CSE - FLIPH</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:chroma"> WELCOME TO CSE - CHROMA</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:dropShadow"> WELCOME TO CSE - DROP SHADOW</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:alpha"> WELCOME TO CSE - ALPHA</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:glow"> WELCOME TO CSE - GLOW</h1> <br /> <br /> <br />

Page 11: Pgms for Record

<h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:gray"> WELCOME TO CSE - GRAY</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:invert"> WELCOME TO CSE - INVERT</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:mask"> WELCOME TO CSE - MASK</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:shadow"> WELCOME TO CSE - SHADOW</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:wave"> WELCOME TO CSE - WAVE</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:x-ray"> WELCOME TO CSE - X RAY</h1> <br /> <br /> <br /> <h1 style="position:absolute; top:50 left:50; font-family:Arial, Helvetica, sans-serif; filter:light"> WELCOME TO CSE - LIGHT</h1> <br /> <br /> <br /> </body></html>

Page 12: Pgms for Record

OUTPUT:

Page 13: Pgms for Record
Page 14: Pgms for Record

Fibonacci series<html><SCRIPT LANGUAGE="VBSCRIPT">DIM n,f0,f1,f2,in=cint(inputbox("enter the first number"))DOCUMENT.WRITE("Fibonacci series")&space(10)f0=-1f1=1DOCUMENT.WRITE("Fibonacci series")&space(100)for i = 1 to n step 1 f2=f0+f1DOCUMENT.WRITE(f2)&space(1)f0=f1f1=f2NEXT

</script></html>

AREA OF CIRCLE USING SUBPROCEDURE

PROGRAM:

<html>

<head><title> sub-procedure </title><script type="text/vbscript">sub calculate(radius)dim pi,areapi=3.14area=pi*radius*radiusmsgbox"The area of circle"&areaEnd sub</script></head>

Page 15: Pgms for Record

<body><input type="button" value="area" onclick="calculate(5)">

</body></html>

OUTPUT:

Page 16: Pgms for Record

FACTORIAL

PROGRAM:

<html><title> factorial </title>

<head><script language=javascript>

var i,num,f; num=prompt("enter the number:",""); f=1; for(i=1;i<=num;i++)

Page 17: Pgms for Record

f=f*i; document.write("The factorial of " +num+ " is = " +f); </script></head>

<body>

</body></html>

OUTPUT:

Page 18: Pgms for Record
Page 19: Pgms for Record

STUDENT DETAILS USING ARRAY

PROGRAM:

<html><head><title>Student details using array</title></head><body><script language="javascript">var n = prompt("No. of students","");sname = new Array(10);regno=new Array(10);dept=new Array(10);m1=new Array(10);m2=new Array(10);m3 = new Array(10);total = new Array(10);avg = new Array(10);for(i=1;i<=n;i++){ regno[i] = prompt("Enter regno of Student",""); sname[i] = prompt("Enter Name of Student ",""); dept[i] = prompt("Enter the Department",""); m1[i] = prompt("Enter marks1",""); m2[i] = prompt("Enter marks2",""); m3[i] = prompt("Enter marks3",""); total[i]=parseInt(m1[i]) + parseInt(m2[i]) +parseInt(m3[i]); avg[i]=total[i]/3;}document.write("<center><h1><font color=red> Student Details</font> </h1> </center><br>");document.write("<center><table border=2 cellspacing=10% cellpadding=10%> <tr> <th> REGISTER NO <th> STUDENT NAME <th>DEPARTMENT <th> MARK1 <th> MARK2 <th> MARK3 <th> TOTAL <th> AVERAGE</tr></center></table>");for(i=1;i<=n;i++){ document.writeln("<table border=2 cellspacing=30% cellpadding=10%> <tr> <td><font color=red> " + regno[i] + "</font></td>"); document.writeln("<td> <font color=blue> " + sname[i] + "</font></td>"); document.write(" <td> <font color=red>" + dept[i] + "</font></td>" ); document.write(" <td> <font color=green>" + m1[i] + "</font></td>" ); document.write(" <td> <font color=orange>" + m2[i] + "</font></td>" );

Page 20: Pgms for Record

document.write(" <td> <font color=brown>" + m3[i] + "</font></td>"); document.write(" <td> <font color=#99FF33>" + total[i]+ "</font></td>" ); document.write(" <td> <font color=#99FF32>" + avg[i]+ "</font></td>" ); document.write("</tr> </table>");} </script> </body></html>

OUTPUT:

Page 21: Pgms for Record
Page 22: Pgms for Record

STRING OBJECTS

PROGRAM:

<html><head><title> String Methods </title></head>

<body>

<script type="text/javascript">

var txt="Hello World!";

document.writeln("<h1> <font color=red> Normal Operation in String Objects </font> </h1>");

document.write("<p>Big: " + txt.big() + "</p>");document.write("<p>Small: " + txt.small() + "</p>");

Page 23: Pgms for Record

document.write("<p>Bold: " + txt.bold() + "</p>");document.write("<p>Italic: " + txt.italics() + "</p>");

document.write("<p>Blink: " + txt.blink() + " (does not work in IE)</p>");document.write("<p>Fixed: " + txt.fixed() + "</p>");document.write("<p>Strike: " + txt.strike() + "</p>");

document.write("<p>Fontcolor: " + txt.fontcolor("Red") + "</p>");document.write("<p>Fontsize: " + txt.fontsize(16) + "</p>");

document.write("<p>Lowercase: " + txt.toLowerCase() + "</p>");document.write("<p>Uppercase: " + txt.toUpperCase() + "</p>");

document.write("<p>Subscript: " + txt.sub() + "</p>");document.write("<p>Superscript: " + txt.sup() + "</p>");

document.write("<p>Link: " + txt.link("http://www.w3schools.com") + "</p>");

</script>

</body></html>

OUTPUT:

Page 24: Pgms for Record

EMPLOYEE DETAILS

PROGRAM CODING:

<html><head><title>EMPLOYEE DETAILS</title>

<script type="text/javascript" >function calc(form){

var sal,hra,da,ta,pf,net;sal=form.salary.value;sal=parseInt(form.salary.value);

if(form.name.value==""){

alert("Enter the name");}

if(sal > 0 ){

hra=(sal*12)/100;da=(sal*6)/100;

Page 25: Pgms for Record

ta=(sal*5)/100;pf=(sal*3)/100;net=( sal+hra + ta + da - pf );

form.hratext.value=hra;form.datext.value=da;form.tatext.value=ta;form.pftext.value=pf;form.nettext.value=net;

}

else{

alert("Enter numerical input for salary");}

}

</script></head>

<body font-face="Rupee Foradian"><form name="employee"><br><br><center><h3> EMPLOYEE DETAILS</h3><br>

<table border=0><tr><td>Name </td><td> <input type="text" name="name"/></td></tr>

<tr><td>Enter the salary </td><td><input type="text" name="salary"/></td></tr>

<tr><td>HRA </td><td><input type="text" name="hratext"/></td></tr>

<tr><td>DA </td><td><input type="text" name="datext"/></td></tr>

Page 26: Pgms for Record

<tr><td>TA </td><td><input type="text" name="tatext"/></td></tr>

<tr><td>PF </td><td><input type="text" name="pftext"/></td></tr>

<tr><td>Net Pay </td><td><input type="text" name="nettext"/></td></tr>

<tr><td></td><td><center><input type="button" name="calculate" value="Calculate" onclick="calc(this.form)"/><input type="reset"><center></td></tr>

</table></center></form> </body> </html>

OUTPUT:

Page 27: Pgms for Record
Page 28: Pgms for Record

ONLINE STUDENT REGISTRATION FORM

PROGRAM CODING:

Register.html

<html><head><title ALIGN="CENTER">RESUME REGISTRATION</title><h1 FACE="ARIAL BLACK" ALIGN="CENTER"><i>RESUME REGISTRATION</i></h2><script language="javascript" type="text/javascript">function namevalidate(){

var win;

win=open("about:blank","namevalidate",'menubar,toolbar,location,directories,status,scrollbar,resizable,height=500,width=700,scroll=yes')

win.document.writeln("<html><head><title>REPORT</title></head><body bgcolor=#B5A642><font face=arial><b><center><h1>RESUME REPORT </center></b></h1>");

win.document.writeln("<tr>Name :"+document.resume.name.value+"<br>");win.document.writeln("<tr>Address :"+document.resume.addr.value+"<br>");win.document.writeln("Date of

Birth :"+document.resume.day.value+"-"+document.resume.month.value+"-"+document.resume.year.value+"<br>");

for(var i=0;i<=document.resume.sex.length;i++){

if(document.resume.sex[i].checked){win.document.writeln("Sex :"+document.resume.sex[i].value+"<br>");break;}

}for(var i=0;i<=document.resume.course.length;i++){

if(document.resume.course[i].checked){

Page 29: Pgms for Record

win.document.writeln("Qualification :"+document.resume.course[i].value+"<br>");break;}

}win.document.writeln("University :"+window.document.resume.univer.value+"<br>");win.document.writeln("Nature of Job :"+window.document.resume.job.value+"<br>");for(var i=0;i<=document.resume.mode.length;i++){

if(document.resume.mode[i].checked){win.document.writeln("Mode of Interview :"+document.resume.mode[i].value+"<br>");break;}

}win.document.writeln("Area of Interest :");var j="";for(var i=0;i<document.resume.area.length;i++){

if(document.resume.area[i].checked){

j=j+document.resume.area[i].value+",";

}}win.document.writeln(j.substring(0,j.length-1)+"."+"<br>");win.document.writeln("File :"+document.resume.file.value+"<br>");win.document.writeln("</font></table></body></html>");

}</script></head><body bgcolor="#sddf6y"><fieldset align=justify >

<legend><b>PROFILE DETAILS</b></legend><br><pre><font face="arial" size=4><form name="resume">

Name: <input type="text" name="name" text color="red"><br>Address: <input type="text" name="addr"><br>Date of Birth: <select type="dropdown" name="day">

<option value="01">01</option> <option value="02">02</option><option value="03">03</option><option value="04">04</option><option value="05">05</option><option value="06">06</option><option value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option>

Page 30: Pgms for Record

<option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option></select> <select type="dropdown" name="month"><option value="Jan">Jan</option><option value="Feb">Feb</option><option value="Mar">Mar</option><option value="Apr">Apr</option><option value="May">May</option><option value="Jun">Jun</option><option value="Jul">Jul</option><option value="Aug">Aug</option><option value="Sep">Sep</option><option value="Oct">Oct</option><option value="Nov">NOv</option><option value="Dec">Dec</option>

</select> <select type="dropdown" name="year"><option value="1980">1980 <option value="1981">1981 <option value="1982">1982 <option value="1980">1983<option value="1984">1984 <option value="1985">1985 <option value="1986">1986 <option value="1987">1987<option value="1988">1988 <option value="1989">1989 <option value="1990">1990 <option value="1991">1991<option value="1992">1992 <option value="1993">1993 <option value="1994">1994 <option value="1995">1995<option value="1996">1996</select><br><br>

Sex: <input type="radio" name="sex" value="Male">Male <input type="radio" name="sex" value="Female">Female<br>

Qualification: <input type="radio" name="course" value="UG">UG <input type="radio" name="course" value="PG">PG<br>

University: <select name="univer"><option value="Pondicherry University">Pondicherry University</option><option value="Anna University">Anna University</option><option value="Annamalai University">Annamalai University</option></select><br>

Nature of Job: <select name="job"><option value="Software Engineer">Software Engineer<option value="Software Analyst">Software Analyst</select><br>

Mode of Interview: <input type=radio name="mode" value="Phone">Phone<input type=radio name="mode" value="System">System <input type=radio

name="mode" value="Walk in">Walk in<br> <input type=checkbox name="area" value="Network

Architecture">Network Architecture <input type=checkbox name="area" value="OS">OS<br>

Area of Interest: <input type=checkbox name="area" value="c,c++">c,c++ <input type=checkbox name="area" value="DBMS">DBMS<br>

<input type=checkbox name="area" value=Java>Java <input type=checkbox name="area" value="OOps">OOPS<br><br>

Attaching Support Information: <input type="file" name="file"value="Browse"><br>

Page 31: Pgms for Record

<input type="button" value="SUBMIT" onClick="namevalidate()"><input type="button" value="CANCEL"><br>

</form></font></pre></fieldset></body></html>

INPUT BOX

PROGRAM CODING:

Im.html

<html><head><title>Input Box & Message Box</title></head><body><script type="text/vbscript">dim aa=inputbox("Enter Your Name:","")msgbox"Welcome to SMVEC! " &a</script></body></html>

Page 32: Pgms for Record

OUTPUT:

STUDY OF WEB SERVERSAIM To study the configuration of

Internet Information Server (IIS) and Apache Web Server.

INTERNET INFORMATION SERVER(IIS):Introduction:

IIS (Internet Information Server) is a group of Internet servers (including a Web or Hypertext Transfer Protocol server and a File Transfer Protocol server) with additional capabilities for Microsoft's

Page 33: Pgms for Record

Windows NT and Windows 2000 Server operating systems. IIS is Microsoft's entry to compete in the Internet server market that is also addressed by Apache, Sun Microsystems, O'Reilly, and others. With IIS, Microsoft includes a set of programs for building and administering Web sites, a search engine, and support for writing Web-based applications that access databases. Microsoft points out that IIS is tightly integrated with the Windows NT and 2000 Servers in a number of ways, resulting in faster Web page serving.

A typical company that buys IIS can create pages for Web sites using Microsoft's Front Page product (with its WYSIWYG user interface). Web developers can use Microsoft's Active Server Page (ASP) technology, which means that applications - including ActiveX controls - can be imbedded in Web pages that modify the content sent back to users. Developers can also write programs that filter requests and get the correct Web pages for different users by using Microsoft's Internet Server Application Program Interface (ISAPI) interface. ASPs and ISAPI programs run more efficiently than common gateway interface (CGI) and server-side include (SSI) programs, two current technologies. (However, there are comparable interfaces on other platforms.)

Microsoft includes special capabilities for server administrators designed to appeal to Internet service providers (ISPs). It includes a single window (or "console") from which all services and users can be administered. It's designed to be easy to add components as snap-ins that you didn't initially install. The administrative windows can be customized for access by individual customers. Configuring IIS in Windows

This section describes how to configure IIS for ColdFusion MX in Windows, and how to verify your configuration. You configure IIS using the Web Server Configuration Tool in either GUI or command-line mode. This describes how to use GUI mode. To use the command line, open the batch files located in cf_root\bin\connectors. To configure IIS for ColdFusion MX in Windows:

1. Start the Web Server Configuration Tool by selecting Start > Programs > Macromedia ColdFusion MX > Web Server Configuration Tool from the Start menu.

2. Click Add. 3. In the Server drop-down list box, select the host name and the server or cluster name that you

want to configure. In the ColdFusion MX server configuration, the server name is always default. Clustering support is only available on the JRun J2EE configuration. Note: The server or cluster does not have to reside on the web server computer.

4. In the Web Server Properties area, select IIS and specify the website. For IIS, you typically specify All.

5. Select Configure web server for ColdFusion MX applications. Caution: Omitting the previous step causes your web server to serve ColdFusion MX source code.

6. Click OK. 7. Copy the CFIDE and cfdocs directories from cf_root\wwwroot to your web server root directory.

In addition, copy your application's CFM pages from cf_root\wwwroot to your web server root directory.

To verify your IIS configuration:1. Verify that the following file was created: cf_root\runtime\lib\wsconfig\jrun.dll (server

configuration) or jrun_root/lib/wsconfig/jrun.dll (JRun J2EE configuration). On IIS6, this file is named jrun_iis6.dll.

Page 34: Pgms for Record

2. For each of your IIS websites, verify that application mappings for .cfm, .cfml, .cfc, .jsp, and .jws were added, as follows:

a. In IIS, right-click an IIS website and select Properties. b. In the Properties dialog box, on the Home Directory tab, click Configuration. c. In the Application Configuration dialog box, click the App Mappings tab.

You should see mappings for .cfm, .cfml, .cfc, .jsp, and .jws in the Extension column.3. Verify that each of your IIS websites has a virtual directory called JRunScripts.

The following figure shows a sample JRunScripts virtual directory:

4. Verify that the JRunScripts directory in each of your IIS websites points to the correct location, as follows:

a. Right-click the JRunScripts directory and select Properties. b. In the Properties dialog box, on the Virtual Directories tab, verify that the Local Path text

box contains the following path: path/wsconfig/number (typically 1)

CONFIGURATION OF APACHE TOMCAT SERVER: Most people will just want to download the preconfigured Tomcat version, set JAVA_HOME and CLASSPATH, and they are done.Install the JDK. Make sure JDK 1.5 or 1.6 is installed and your PATH is set so that both "java -version" and "javac -help" give a result. Install the JDKYour first step is to download and install Java. Tomcat 6.0 requires JDK 1.5 Standard Edition (Java 5) or JDK 1.6 Standard Edition (Java 6). See the following sites for download and installation information.

JDK 1.5 (Java 5) for Windows, Linux, and Solaris: http://java.sun.com/javase/downloads/index_jdk5.jsp. Be sure you download the full JDK (J2SE Development Kit), not just the JRE (Java Runtime Environment). The JRE is only for running already-compiled .class files, and lacks a compiler.

JDK 1.6 (Java 6) for Windows, Linux, and Solaris: http://java.sun.com/javase/downloads/index.jsp. Be sure you download the full JDK (J2SE

Page 35: Pgms for Record

Development Kit), not just the JRE (Java Runtime Environment). The JRE is only for running already-compiled .class files, and lacks a compiler.

Java for MacOS: http://developer.apple.com/java/download/. Once you've installed Java, confirm that everything including your PATH is configured properly by opening a DOS window and typing "java -version" and "javac -help". You should see a real result both times, not an error message about an unknown command. Or, if you use an IDE, compile and run a simple program to confirm that the IDE knows where you installed Java.For example, if you have JDK 1.5_08, you could set your PATH by putting the following line in your C:\autoexec.bat file. set PATH="C:\Program Files\Java\jdk1.5.0_08\bin";%PATH% On Windows XP, you could also go to the Start menu, select Control Panel, choose System, click on the Advanced tab, press the Environment Variables button at the bottom, and enter the PATH variable and value directly. On Windows 2000 and NT, you do Start, Settings, Control Panel, System, then Environment. However, you can use C:\autoexec.bat on those versions of Windows also (unless a system administrator has set your PC to ignore it).

Configure TomcatConfiguring Tomcat involves four main steps and five optional steps:

1. Downloading the Tomcat software. 2. Setting the JAVA_HOME variable. 3. Changing the port from 8080 to 80. 4. Telling Tomcat to reload servlets when they are modified. 5. Enabling the invoker servlet. 6. Turning on directory listings. 7. Setting the CATALINA_HOME variable. (Optional; rarely used) 8. Using a preconfigured version of Tomcat with these changes already made. (Optional; widely

used) 9. Using the Windows .exe installer instead of the .zip file. (Not Recommended)

Details of each step are given below. If Tomcat is already running, restart it after performing these steps.

1. Download the Apache Tomcat SoftwareGo to http://tomcat.apache.org/download-60.cgi and download and unpack the zip file for the current release build of Tomcat 6. You specify the top-level directory (e.g., C:\) and the zip file has embedded subdirectories (e.g., apache-tomcat-6.0.10). Thus, C:\apache-tomcat-6.0.10 is a common resultant installation directory. Note: from this point forward, I'll refer to that location as install_dir. For Windows, there is also a .exe installer; I prefer the .zip file, but see the .exe installer section for notes on the differences between the two.Alternatively, you can use my preconfigured Jakarta Tomcat version. This version already has the port changed to 80, servlet reloading enabled, and the invoker servlet turned on. It also comes with a sample development directory, autoexec.bat file, startup/shutdown shortcuts, and shortcuts for deploying applications.

Page 36: Pgms for Record

2. Set the JAVA_HOME VariableNext, you must set the JAVA_HOME environment variable to tell Tomcat where to find Java. Failing to properly set this variable prevents Tomcat from compiling JSP pages. This variable should list the base JDK installation directory, not the bin subdirectory. For example, on almost any version of Windows, if you use JDK 1.5_08, you might put the following line in your C:\autoexec.bat file. set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_08 On Windows XP, you could also go to the Start menu, select Control Panel, choose System, click on the Advanced tab, press the Environment Variables button at the bottom, and enter the JAVA_HOME variable and value directly. On Windows 2000 and NT, you do Start, Settings, Control Panel, System, then Environment. However, you can use C:\autoexec.bat on those versions of Windows also (unless a system administrator h as set your PC to ignore it).

3. Change the Port to 80Assuming you have no other server already running on port 80, you'll find it convenient to configure Tomcat to run on the default HTTP port (80) instead of the out-of-the-box port of 8080. Making this change lets you use URLs of the form http://localhost/blah instead of http://localhost:8080/blah. Note that you need admin privileges to make this change on Unix/Linux. Also note that some versions of Windows XP automatically start IIS on port 80. So, if you use XP and want to use port 80 for Tomcat, you may need to disable IIS (see the Administrative Tools section of the Control Panel).To change the port, edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80, yielding a result similar to that below. <Connector port="80" ... maxThreads="150" ... You can also:

Use my preconfigured Jakarta Tomcat version. Apache Tomcat 6.0.10 with all server.xml, context.xml, and web.xml changes, plus the sample HTML, JSP, and Java files.

Download my modified server.xml for Tomcat 6.0. From Apache Tomcat 6.0.10, but should work on most versions of Tomcat 6.0. Right-click or shift-click on the link to download the file.

4. Turn on Servlet ReloadingThe next step is to tell Tomcat to check the modification dates of the class files of requested servlets, and reload ones that have changed since they were loaded into the server's memory. This slightly degrades performance in deployment situations, so is turned off by default. However, if you fail to turn it on for your development server, you'll have to restart the server every time you recompile a servlet that has already been loaded into the server's memory. Since this tutorial discusses the use of Tomcat for development, this change is strongly recommended.To turn on servlet reloading, edit Edit install_dir/conf/context.xml and change <Context> to <Context reloadable="true" privileged="true"> Note that the privileged entry is really to support the invoker servlet (see the following section), so you can omit that entry if you do not use the invoker.

Page 37: Pgms for Record

You can also: Use my preconfigured Tomcat version. Tomcat 6.0.10 with all server.xml, context.xml, and

web.xml changes, plus the sample HTML, JSP, and Java files.

Download my modified context.xml for Tomcat 6.0. From Tomcat 6.0.10, but should work on most versions of Tomcat 6.0. Right-click or shift-click on the link to download the file.

5. Enable the Invoker ServletThe invoker servlet lets you run servlets without first making changes to your Web application's deployment descriptor (i.e., the WEB-INF/web.xml file). Instead, you just drop your servlet into WEB-INF/classes and use the URL http://host/servlet/ServletName (or http://host/webAppName/servlet/ServletName once you start using your own Web applications. The invoker servlet is extremely convenient when you are learning and even when you are testing things doing your initial development. You almost certainly want to enable it when learning, but you should disable it again before deploying any real applications.To enable the invoker servlet, uncomment the following servlet and servlet-mapping elements in install_dir/conf/web.xml. Do not confuse this Apache Tomcat-specific web.xml file with the standard one that goes in the WEB-INF directory of each Web application. <servlet> <servlet-name>invoker</servlet-name> <servlet-class> org.apache.catalina.servlets.InvokerServlet </servlet-class> ... </servlet> ... <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> In Tomcat 6 (but not Tomcat 5.5), you also need the privileged="true" entry in the Context element of context.xml. See the previous section for an example.You can also:

Use my preconfigured Tomcat version. Tomcat 6.0 with all server.xml, context.xml, and web.xml changes, plus the sample HTML, JSP, and Java files.

Download my modified web.xml for Tomcat 6.0. From Tomcat 6.0.10, but should work on most versions of Tomcat 6.0. Right-click or shift-click on the link to download the file.

6. Turn on Directory Listings (Optional)In previous Tomcat versions, if you entered a URL ending in a slash (/) and there was no welcome-file in the directory (or servlet-mapping that matched the URL), Tomcat displayed a directory listing. In Tomcat 6, the default was changed from true to false for these directory listings. Many developers find it convenient to turn directory listings back on. To make this change, edit install_dir/conf/web.xml and change the init-param value of listings for the default

Page 38: Pgms for Record

servlet, as below. Do not confuse this Apache Tomcat-specific web.xml file with the standard one that goes in the WEB-INF directory of each Web application.

<servlet> <servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> You can also:

Use my preconfigured Tomcat version. Tomcat 6.0 with all server.xml, context.xml, and web.xml changes, plus the sample HTML, JSP, and Java files.

Download my modified web.xml for Tomcat 6.0. From Tomcat 6.0.10, but should work on most versions of Tomcat 6.0. Right-click or shift-click on the link to download the file.

7. Set the CATALINA_HOME Variable (Optional)If you are going to make copies of the Tomcat startup or shutdown scripts (e.g., startup.bat and shutdown.bat), it is also helpful to set the CATALINA_HOME environment variable to refer to the top-level directory of the Apache Tomcat installation (e.g., C:\apache-tomcat-6.0.10). This variable identifies the Tomcat installation directory to the server. However, if you are careful to avoid copying the server scripts and you use only shortcuts (called "symbolic links" on Unix/Linux) instead, you are not required to set this variable.

8. Using the Preconfigured Tomcat Version (Optional)Please see the preconfigured Tomcat page to get a version of Jakarta Tomcat 6.0 with all configuration settings already made. Just unzip the file, set your JAVA_HOME and CLASSPATH variables, and you are read to go.

9. Using the Windows .exe InstallerIf you are using Microsoft Windows, you can download a .exe installer instead of the .zip file discussed in this tutorial. In my opinion, it is not worth the bother to do so, but some people like it. If you use it, note these differences:

It will prompt you for the desired port. It will ask you what port it should run on, and make the changes in server.xml for you. You will still need to manually edit context.xml and web.xml, however.

It will set JAVA_HOME for you. The installer hunts for your Java installation and tries to set JAVA_HOME appropriately. This is a convenience, albeit a minor one.

Page 39: Pgms for Record

It will setup Start Menu entries. In particular, instead of using startup.bat and shutdown.bat, you can go to the Start Menu, select Apache Tomcat 6.0, select Monitor Tomcat, and select Start or Stop, as shown below. I prefer startup.bat and shutdown.bat so that I can put shortcuts in my development directory (easier to invoke) and/or the desktop (where I can associate keyboard shortcuts).

Test the server . 1. Verify that you can start the server. Double-click install_dir/bin/startup.bat and try

accessing http://localhost/. 2. Check that you can access your own HTML & JSP pages. Drop some simple HTML

and JSP pages into install_dir/webapps/ROOT and access them with http://localhost/filename.

3. Try Compiling and Deploying Servlets.

Set up your development environment. 1. Create a development directory. Put it anywhere except within the Tomcat

installation hierarchy. 2. Make shortcuts to the Tomcat startup & shutdown Scripts. Put shortcuts to

install_dir/bin/startup.bat and install_dir/bin/shutdown.bat in your development directory and/or on your desktop.

3. Set your class path. Use the CLASSPATH environment variable or set the path in the project settings of your IDE. Include the current directory ("."), the servlet/JSP JAR files (install_dir/lib/servlet-api.jar, and install_dir/lib/jsp-api.jar, and install_dir/lib/el-api.jar), and your main development directory from Step 1.

Page 40: Pgms for Record

4. Bookmark the servlet & JSP javadocs. Add the servlet 2.4 API and the JSP 2.0 API to your bookmarks/favorites list.

Compile and test some simple servlets. 1. Test a packageless servlet. Compile a simple servlet, put the .class file in

install_dir/webapps/ROOT/WEB-INF/classes, and access it with http://localhost/servlet/ServletName.

2. Test a servlet that uses packages. Compile the servlet, put the .class file in install_dir/webapps/ROOT/WEB-INF/classes/packageName, and access it with http://localhost/servlet/packageName.ServletName.

3. Test a servlet that uses packages and utility classes. Compile a servlet, put both the servlet .class file and the utility file .class file in install_dir/webapps/ROOT/WEB-INF/classes/packageName, and access the servlet with http://localhost/servlet/packageName.ServletName. This third step verifies that the CLASSPATH includes the top level of your development directory.

Establish a simplified deployment method. 1. Copy to a shortcut. Make a shortcut to install_dir/webapps/ROOT. Copy packageless

.class files directly there. With packages, copy the entire directory there. This is the simplest option for beginners, and the preconfigured Tomcat version already has a development directory with these shortcuts.

2. Use the -d option of javac . Use -d to tell Java where the deployment directory is. 3. Let your IDE take care of deployment. Tell your IDE (Eclipse, NetBeans, JBuilder, etc.)

where the deployment directory is and let it copy the necessary files. 4. Use ant or a similar tool. Use the Apache make-like tool to automate copying of

files.

Page 41: Pgms for Record

RESULT:

Page 42: Pgms for Record

Thus the configuration of web server such as Internet Information Server(IIS) and Apache Tomcat server have been studied.

DATE

PROGRAM:

<%@page language ="java"%><%--This is the HTML content--%><HTML><HEAD><TITLE>A Dynamic Content example</TITLE></HEAD><BODY bgcolor=”#FFEAFF”><H1>Welcome</H1><HR><H3>Today’s date and time:</H3><%--This is the JSP content that displays the server time by using the method Date()--%><%= new java.util.Date() %></BODY></HTML>

Page 43: Pgms for Record

OUTPUT:

Page 44: Pgms for Record

FILE INCLUSION

PROGRAM:

<%@ page language="java" %><html><head><title> An Include example</title></head><body><h2>This is the content of first.jsp</h2><hr><%="Hello, welcome to the world of Java Server Pages!!!" %><%@ include file="second.jsp" %></body></html>

<%@ page language="java" %><html><head><title> An Include example</title></head><body><h2>This is the content of second.jsp</h2><hr><%="Hope you’re having fun learning JSP" %></body></html>

Page 45: Pgms for Record

OUTPUT:

COUNT

PROGRAM:

<%@ page language="java"%>

<html><head><title>Count program in JSP</title></head>

<body>

Page 46: Pgms for Record

<%!int cnt=0;private int getcount(){// increment cnt and return the valuecnt++;return cnt;}%><p> The Values of cnt are:<p><%=getcount()%><br><%=getcount()%><br><%=getcount()%><br><%=getcount()%><br><%=getcount()%><br><%=getcount()%><br></body></html>

OUTPUT:

Page 47: Pgms for Record

EVEN

PROGRAM:

<%@ page language="java"%>

<html><head><title>Even number program in JSP</title></head>

<body>

Page 48: Pgms for Record

<%

for(int i=0;i<=10;i++) {

if((i%2)==0) { out.print("Even number :"+i); out.print("<br>"); }

}

%>

</body></html>

OUTPUT:

Page 49: Pgms for Record

ARITHMETIC OPERATION

PROGRAM:

Input.html

<html><head><title>ARITHMETIC OPEARTION</title></head>

<body><b><H1 align= "center" > <font color="green"> MATHEMATICAL FUNCTIONS</font></H1></b><form name="in" method="post" action="calculate.jsp"><table align="center" cellpadding="5%" cellspacing="5%" border="3" bordercolor="#FF0000"><tr> <td> ENTER THE NO1 <input type="text" name="t1"/> </td></tr><tr><td> ENTER THE NO2 <input type="text" name="t2" /> </td></tr><tr><td><input name="radio" type="radio" value="add" />ADDITION </td></tr><tr>

Page 50: Pgms for Record

<td><input name="radio" type="radio" value="sub" />SUBTRACTION</td></tr><tr><td><input name="radio" type="radio" value="mul" />MULTIPLICATION</td></tr><tr><td><input name="radio" type="radio" value="div" />DIVISION</td></tr></table>

<br /><br /><table align="center" cellpadding="5%" cellspacing="5%" border="3" bordercolor="#FF0000"><tr><td> <input type="submit" name="b1" value="Submit here" /></td><td> <input type="reset" name="re1" value="Reset here" /></td></tr></table></form></body></html>

Calculate.jsp:

<%@ page language="java"%><%@ page import="java.lang.*" %>

<html><head><title>Calculate Operation</title></head><body><%String str=request.getParameter("radio");String str1=request.getParameter("t1");String str2=request.getParameter("t2");String output="";int num1=0;int num2=0;int num3=0;num1=Integer.parseInt(str1);num2=Integer.parseInt(str2);

Page 51: Pgms for Record

if(str.equals("add")){num3=num1+num2;output="Addition";}if(str.equals("sub")){num3=num1-num2;output="Subtraction";}if(str.equals("mul")){num3=num1*num2;output="multiplication";}if(str.equals("div")){num3=num1/num2;output="Division";}%> <h1>The Selected mathematical function by you is:<%=output %> </h1><br /><br /><%Integer in =new Integer(num3);out.println("<h3>The Result is </h3>" +in.toString());%></body></html>

OUTPUT:

Page 52: Pgms for Record
Page 53: Pgms for Record

SessionManagement

<html>

<head>

<title>Welcome to the first program of jsp</title>

</head>

<body>

<form method = "post" action = "FirstPageOfSession.jsp">

<font size = 6>Enter your name<input type = "text" name = "name"></font><br><br>

<font size = 6>Enter your password<input type="password" name = "pwd" >

</font><br><br>

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

</form>

</body>

</html>

FirstPageOfSession.jsp

<%

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

String password = request.getParameter("pwd");

if(name.equals("Williams") && password.equals("abcde"))

{

session.setAttribute("username",name);

response.sendRedirect("NextPageAfterFirst.jsp");

}

Page 54: Pgms for Record

else

{

response.sendRedirect("SessionManagement.html");

}

NextPageAfterFirst.jsp

<html>

<head>

<title>Welcome in In the program of URL rewriting</title>

</head>

<body>

<font size = 6>Hello</font> <%= session.getAttribute("username") %>

</body>

</html>

Page 55: Pgms for Record