0% found this document useful (1 vote)
1K views95 pages

WTrecord

The document describes an experiment to design a static web page for a college website. It outlines the steps to include HTML tags to structure the page, with headings, paragraphs of text, images and links. HTML tags like <title>, <head>, <body>, <h1>, <p>, <img>, and <a> are used to add the page title, headings, text content, images and links. The goal is to create a well designed static homepage for the college website using basic HTML markup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
1K views95 pages

WTrecord

The document describes an experiment to design a static web page for a college website. It outlines the steps to include HTML tags to structure the page, with headings, paragraphs of text, images and links. HTML tags like <title>, <head>, <body>, <h1>, <p>, <img>, and <a> are used to add the page title, headings, text content, images and links. The goal is to create a well designed static homepage for the college website using basic HTML markup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 95

EXP NO LIST OF EXPERIMENTS DATE

1 Creation of HTML Files


1.1 HTML Tables 26.12.12
1.2 HTML Forms 26.12.12
1.3 HTML Frames 08.01.13
2 Working with Client Side Scripting
2.1 JavaScript
2.1.1 Login Form 08.01.13
2.1.2 Scientific Calculator 08.01.13
2.1.3 Sorting Using JavaScript Array 22.01.13
2.1.4 Character And String Processing 22.01.13
2.1.5 Registration Form 29.01.13
2.2 VBScript
2.2.1 Built- In Functions 29.01.13
2.2.2 Functions And Procedures 29.01.13
3 Configuration of web servers
3.1 Apache Web Server 05.02.13
3.2 Internet Information Server (IIS) 05.02.13
4 Working with ActiveX Controls in web document. 12.02.13
5 Experiments in Java Server Pages
5.1 Implementing MVC Architecture using Servlets ( Book advisor 12.02.13
Application)
5.2 Data Access Programming (Display university result) 19.02.13
5.3 Session object (count visiting page) 19.02.13
5.4 File System Management (reading and checking file) 26.02.13
6 Ajax Programming 26.02.13
7 Working with other Server Side Scripting
7.1 Java Servlets (Student registration form) 26.02.13
7.2 PHP (Basic Contact form) 12.03.13
7.3 Active Server Pages( Login form) 12.03.13
8 Developing E-commerce application (Mini Project) 19.03.13
9 Develope and Consume Web Service 26.03.13
Aim:
To write the html program to implement the class time table.
Algorithm:
1. Start the Process
2. Include a title for the document using <TITLE> Tag in head section
3. Include <BODY> tag that enclose all the tags
4. Specify the heading using H1, H2 etc.
5. Include the <TABLE> Tag in the body section. Specify the attributes such as BGcolor,
rowspan, colspan, wherever necessary.
6. Include <TR> tag to specify the rows.
7. Use <TH> tag to specify the heading of the column.
8. Specify the table data of definition using <TD> tad.
9. Repeat the step 8 to complete the creation of table with data.
10. Close all the tags.
Coding:
<html>
<body>
<table border="5" align="center" bordercolor="brown">
<caption> Time Table </caption>
<tr>
<th bordercolor="blue" bgcolor="skyblue"> Time </th>
<th bordercolor="blue" bgcolor="violet"> 9.15-10 </th>
<th bordercolor="blue" bgcolor="violet"> 10-10.45 </th>
<th bordercolor="blue" bgcolor="violet"> 10.45-11.30</th>
<th bordercolor="blue" bgcolor="violet"> 11.30-11.45 </th>
<th bordercolor="blue" bgcolor="violet"> 11.45-12.30 </th>
<th bordercolor="blue" bgcolor="violet"> 12.30-1.30 </th>
<th bordercolor="blue" bgcolor="violet"> 1.30-2.00 </th>
<th bordercolor="blue" bgcolor="violet"> 2.00-2.45 </th>
<th bordercolor="blue" bgcolor="violet"> 2.45-3.30 </th>
<th bordercolor="blue" bgcolor="violet"> 3.30-4.15 </th>
<th bordercolor="blue" bgcolor="violet"> 4.15-5 </th>
</tr>
<tr>
<th bordercolor="blue" bgcolor="violet"> Period/Day </th>
<th bordercolor="Blue"bgcolor="pink"> 1</th>
<th bordercolor="blue" bgcolor="pink"> 2 </th>
<th bordercolor="blue" bgcolor="pink"> 3 </th>
<td rowspan="9"> <p style="text-align=center;">B</p>
<p style="text-align=center;">R</p>
<p style="text-align=center;">E</p>
<p style="text-align=center;">A</p>
<p style="text-align=center;">K</p> </td>
<th bordercolor="blue" bgcolor="pink"> 4 </th>
<th bordercolor="blue" bgcolor="pink"> 5 </th>
<td rowspan="9"> <p style="text-align=center;">L</p>
<p style="text-align=center;">U</p>
<p style="text-align=center;">N</p>
<p style="text-align=center;">C</p>
<p style="text-align=center;">H</p> </td>
<th bordercolor="blue" bgcolor="pink"> 6 </th>
<th bordercolor="blue" bgcolor="pink"> 7 </th>
<th bordercolor="blue" bgcolor="pink"> 8 </th>
<th bordercolor="blue" bgcolor="pink"> 9 </th>
</tr>
<tr>
<th bordercolor="blue" bgcolor="violet"> Monday </th>
<td bordercolor="blue"> <p style="text-align=center;">DBMS</p> </td>
<td bordercolor="blue"> <p style="text-align=center;">DBMS</p> </td>
<td bordercolor="blue"> <p style="text-align=center;">SE</p> </td>
<td bordercolor="blue"> <p style="text-align=center;">WCN</p> </td>
<td bordercolor="blue"> <p style="text-align=center;">WT</p> </td>
<td colspan="4" bordercolor="blue"bgcolor="orange"> <p style="text-
align=center;">MiniProject Lab</p> </td>
<tr>
<tr>
<th bordercolor="blue" bgcolor="violet"> Tuesday </th>
<td bordercolor="blue"> SE </td>
<td bordercolor="blue"> DBMS </td>
<td bordercolor="blue"bgcolor="orange"> WT Lab </td>
<td colspan="2" bordercolor="blue" bgcolor="orange"><p style="text-align=center;">
WT lab</p> </td>
<td bordercolor="blue"> OOAD </td>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> WCN </td>
<td bordercolor="blue"> WT </td>
</tr>
<tr>
<th bordercolor="blue" bgcolor="violet"> Wednesday </th>
<td bordercolor="blue"> WT </td>
<td bordercolor="blue"> WCN </td>
<td bordercolor="blue"> SE </td>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> OOAD </td>
<td colspan="2" bordercolor="blue"> OOAD </td>
<td bordercolor="blue"> WT </td>
<td bordercolor="blue"> DBMS </td>
</tr>
<tr>
<th bordercolor="blue" bgcolor="violet"> Thursday </th>
<td bordercolor="blue"> WCN </td>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> WCN </td>
<td bordercolor="blue"> SE </td>
<td bordercolor="blue"> DBMS </td>
<td bordercolor="blue"> WT </td>
<td colspan="3" bordercolor="blue" bgcolor="orange"> <p style="text-
align=center;">DBMS Lab</p> </td>
<tr>
<tr>
<th bordercolor="blue" bgcolor="violet">Friday </th>
<td bordercolor="blue"> OOAD </td>
<td bordercolor="blue"> DBMS </td>
<td bordercolor="blue"> WT </td>
<td bordercolor="blue"> SE </td>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> WCN </td>
<td bordercolor="blue"> OOAD </td>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> SE </td>
</tr>
<tr>
<th bordercolor="blue" bgcolor="violet"> Saturday </th>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> DMW </td>
<td bordercolor="blue"> DBMS </td>
<td bordercolor="blue"> WCN </td>
<td bordercolor="blue"> DBMS </td>
<td bordercolor="blue"> SE </td>
<td bordercolor="blue"> OOAD </td>
<td bordercolor="blue"> WT </td>
<td bordercolor="blue"> OOAD </td>
</tr>
</html>
</body>
Output:

Result:

Thus Timetable is designed successfully using table tag in html.


Aim:
To design the HTML document for the form creation.
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. Specify the form by using the <FORM> tag and specify the name for the form.
5. Create the table by using the <TABLE> tag.
6. Specify the number of rows by using <TR> tag.
7. Specify the data for the table by using <TD> tag.
8. Specify the column heading by using <TH> tag.
9. Add the <OPTION> tag to select the state, caste.
10. Close the <FORM> tag.
11. Close all the tags.
Coding:
<html>
<head>
<title> Birth certificate Form </title>
</head>
<body bgcolor="pink">
<table>
<h3 text align="center"> Birth certificate </h3>
<hr color="Blue">
<tr >
<td><p> <B> Name: <B></td>
<td> <input type="text"></td>
</tr>
<tr>
<td>
<p> Father Name:</td><td> <input type="text"></td>
</tr>
<td><p> Mother Name: </td><td><input type="text"></td>
</tr>
<tr>
<td>
<p> Gender: <td><input type="radio" name="y">yes
<input type="radio" name="n" checked> no </td>
</p>
</tr>
<tr>
<td>
<p> Resediential Address: <td><textarea roes="4" cols="25"></textarea></td></p>
</td>
</tr>
<td><p> Religion: </td><td>Hindu<input type="checkbox">
Christian
<input type="checkbox">
Muslim<input type="checkbox">
Others
<input type="checkbox"></td>
</tr>
<tr>
<td>
<p> Birth Date:<td> <input type ="number"></td></p>
</td>
</tr>
<tr>
<td>
<p> Birth Place:<td>
<select name="state">
<option> Puducherry </option>
<option> Tamilnadu</option>
</select> </td>
</tr>
<tr>
<td>
<p> Cast: <td><select name="state">
<option> MBC </option>
<option> OBC</option>
<option> SC </option>
</select></td>
</tr>
</p>
</table>
<p>
<input name="button2" type="button" value="Reset" >
<input name="button" type="button" value="Submit" >
</body>
</html>
Output:

Result:

Thus form is created successfully using form tag in html.


Aim:
To design the static web page required for a college web site.
Algorithm:
1. Start the Process
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. To divide the screen, include the <FRAMESET> tag to specify the number of section.
Give a name to each page using the name attribute of <FRAME> tag.
5. Include a <FRAME> tag, specify the location of the document to be displayed.
6. Close the </FRAMESET> tag and </HTML> tag.
7. Main HTML tag includes <BODY> tag that enclose all the tags. Use <BR> tag to break
two statements.
8. Using hyperlink as <A HREF> tag is used to link to the specified documents.
9. Close all the tags.
Coding:
Web page:
<html>
<head >
<title>WEB PAGE</title/>
</head>
<frameset rows="20%,50%,30%" >
<frame src="top.html">
<frameset cols="50%,50%">
<frame src="left.html">
<frame src="center.html">
<frame scr="down.html">
</frameset>
<frameset cols="35%,35%,30%">
<frame src="bottom.html">
<frame src="right.html">
<frame src="rright.html">
</frameset>
</frameset>
</html>
Top:
<html>
<body bgcolor ="brown">
<b><font color="red"><h1 align="center">ALPHA COLLEGE OF
ENGINEERING AND TECHNOLOGY</h1></font ></b>
<p align="center"> <a href ="#">HOME</a>
<a href ="#">ABOUT</a>
<a href ="#">GALLERY</a>
<a href ="#">CONTACTS</a></p>
</body>
</html>
Left:
<html>
<body >
<img border="0" src="E:\Indrajith\Gallery_14.jpg" alt="Pulpit rock"
width="600" height="400">
</body>
</html>
Center:
<html>
<body bgcolor ="pink">
<h2><p >Our Mission</p></h2>
<p align="center">To bring about social transformation by imparting
quality technical education <p>
<h2><p >Our Vision</p></h2>
<p align="center">To encourage real talent by providing the right
ambience and environment<p>
<p align="center">To ignite creative minds by providing support for
innovation and research<p>
<h2><p >Recognitions</p></h2>
<p align="center">Approved by AICTE New Delhi<p>
<p align="center">Affiliated to Pondicherry University, Puducherry<p>
</body>
</html>
Bottom:
<html>
<body bgcolor ="cyan">
<marquee><p align="center"><font color
="Red">DEPARTMENTS</font></p></marquee>
<p align="center"><li>CSE</li></p>
<p align="center"><li>IT</li></p>
<p align="center"><li>ECE</li></p>
<p align="center"><li>MECHANICAL</li></p>
<p align="center"><li>EEE</li></p>
</body>
</html>
Right:
<html>
<body bgcolor ="blue">
<marquee><p align="center"><font color ="Red">FACILITIES
Output:

Result:

Thus frame is created successfully using frameset tag in html.


AIM:
To create the HTML document to implement the login form using javascript.
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. Specify the form by using the <FORM> tag and specify the name for the form.
5. Add the <INPUT> tag to retrieve data from the user.
6. Include the appropriate JavaScript definitions using the <SCRIPT> tag. Used to validate
the login form.
7. Close the <FORM> tag.
8. Close all the tags.
Coding:
<html>
<head>
<title> Login </title>
</head>
<script type="text/javascript">
var un,pass;
function fn()
{if(log.uname.value=="jith" && log.m.value=="jith")
{ alert("Login Successful: You are authorised"); }
else { alert("Invalid Security Details");}}
</script>
<body>
<center>
<br<br>
<h><b>LOGIN FORM </b></h>
<br><br>
<br>
<form name="log">
<br>
Enter the user name:
<input type="text" name="uname" />
<br><br>
Enter the password:
<input type="password" name="pword" id="m" /></br></br>
<center><input type="button" value=" Login " onclick="fn()"/></center>
<br><input type="reset" value="Reset" />
</form></center></body></html>
Output:

Result :

Thus login form validation using java script is implemented and executed successfully
Aim:
To design the scientific calculator using JavaScript
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. Specify the form by using the <FORM> tag and specify the name for the form.
5. Create the table by using the <TABLE> tag.
6. Specify the number of rows by using <TR> tag.
7. Specify the data for the table by using <TD> tag.
8. Specify the column heading by using <TH> tag.
9. Include the appropriate JavaScript definitions using the <SCRIPT> tag. Used to validate
the user input, perform the arithmetic calculations like +, -, /, *, sin, cos, tan, sqrt etc.
10. Close all the tags.
Coding:
<html>
<head><title>SCIENTIFIC CALCULATOR</title>
<SCRIPT LANGUAGE="JavaScript">
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
else
input.value += character
}
function cos(form) {
form.display.value = Math.cos(form.display.value);
}

function sin(form) {
form.display.value = Math.sin(form.display.value);
}

function tan(form) {
form.display.value = Math.tan(form.display.value);
}

function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);
}

function ln(form) {
form.display.value = Math.log(form.display.value);
}

function exp(form) {
form.display.value = Math.exp(form.display.value);
}

function deleteChar(input) {
input.value = input.value.substring(0, input.value.length - 1)
}

function changeSign(input) {
if(input.value.substring(0, 1) == "-")
input.value = input.value.substring(1, input.value.length)
else
input.value = "-" + input.value
}

function compute(form) {
form.display.value = eval(form.display.value)
}

function square(form) {
form.display.value = eval(form.display.value) * eval(form.display.value)
}

function checkNum(str) {
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1)
if (ch < "0" || ch > "9") {
if (ch != "/" && ch != "*" && ch != "+" && ch != "-" && ch != "."
&& ch != "(" && ch!= ")") {
alert("invalid entry!")
return false
}
}
}
return true
}
</SCRIPT>
</head>
<body bgcolor="pink" text=red >

<FORM NAME="sci-calc" >


<TR>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" sq " ONCLICK="if
(checkNum(this.form.display.value)) { square(this.form) }"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" 0 "
ONCLICK="addChar(this.form.display, '0')"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" . "
ONCLICK="addChar(this.form.display, '.')"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" +/- "
ONCLICK="changeSign(this.form.display)"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" + "
ONCLICK="addChar(this.form.display, '+')"></TD>
</TR>
<TR>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" ( "
ONCLICK="addChar(this.form.display, ')')"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE="cos" ONCLICK="if
(checkNum(this.form.display.value)) { cos(this.form) }"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" sin" ONCLICK="if
(checkNum(this.form.display.value)) { sin(this.form) }"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" tan" ONCLICK="if
(checkNum(this.form.display.value)) { tan(this.form) }"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE=" ) "
ONCLICK="addChar(this.form.display, ')')"></TD>
</TR>
<TR>
<TD ALIGN="center"><INPUT TYPE="button" VALUE="clear"
ONCLICK="this.form.display.value = 0 "></TD>
<TD ALIGN="center" COLSPAN="3"><INPUT TYPE="button" VALUE="backspace"
ONCLICK="deleteChar(this.form.display)"></TD>
<TD ALIGN="center"><INPUT TYPE="button" VALUE="enter" NAME="enter"
ONCLICK="if (checkNum(this.form.display.value)) { compute(this.form) }"></TD>
</TR>
</TABLE>
</center>
</FORM>

</body>
</html>
Output:

Result :

Thus scientific calculator using java script is implemented and executed successfully
Aim:
To design the Sorting Using JavaScript Array .
Algorithum:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include the appropriate JavaScript definitions using the <SCRIPT> tag
4. Using prompt window get user input to sort the number.
5. Using array sort number in ascending sort.
6. Close all the tags.
Coding:
<html>
<head>
<title> Sort
</title>
<script language="Javascript">
var b,i,j,temp;
var a;
a=[];
document.write("Enter array");
for(i=0;i<5;i++)
{
b=prompt("enter array element=","0");
a[i]=b;
}
for(i=0;i<5;i++)
{
document.write("<br>"+a[i]);
}
document.write("<br>Sorted array is");
for(i=0;i<5;i++)
{for(j=0;j<5;j++)
{if(a[i]<a[j])
{temp=a[i];
a[i]=a[j];
a[j]=temp;
}}}
for(i=0;i<5;i++)
{document.write("<br>"+a[i]);
}</script>
</head>
</html>
Output

Result :

Thus Sorting Using JavaScript Array is implemented and executed successfully


Aim:
To design the string manipulation operation using JavaScript.
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section.
4. Include <BODY> tag to enclose all the tags.
5. Add the <INPUT> tag to retrieve data from the user.
6. Include the appropriate JavaScript definitions using the <SCRIPT> tag. Used to display
the string manipulation like split, substring and character-processing methods.
7. Close all the tags.
Coding:
<head>
<title>String Methods split , substring and Character-Processing Methods </title>
<script type = "text/javascript">
<!--function splitButtonPressed()
{var inputString = document.getElementById( "inputVal" ).value;
var tokens = inputString.split( " " );
document.getElementById( "output" ).value =tokens.join( "\n" );
document.getElementById( "outputSubstring" ).value =inputString.substring( 0, 10 );
document.getElementById( "outputSub" ).value =inputString.charAt( 0 );
document.getElementById( "outputS" ).value =inputString.charCodeAt( 0 );
document.getElementById( "outp" ).value =inputString.toLowerCase();
document.getElementById( "out" ).value =inputString.toUpperCase()
} // end function splitButtonPressed
// --> </script></head>
<body bgcolor="lightblue">
<form action = "">
<h2> Characters and Strings operation </h2>
<p>Enter a sentence to split into words<br />
<input id = "inputVal" type = "text" size = "60" />
<input type = "button" value = "Split"
onclick = "splitButtonPressed()" /></p>
<p>The sentence split into words is
<textarea id = "output" rows = "8" cols = "34">
</textarea></p>
<p>The first 10 characters of the input string are
<input id = "outputSubstring" type = "text" size = "15" />
</p></br><p>Character at index 0 is
<input id = "out" type = "text" size = "60" /></p>
</form></body> </html>
Output:

Result :

Thus Character and String Processing using java script is implemented and executed
successfully.
Aim:
To design a registration form using Java Script and HTML tags.
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. Include the JavaScript using the <SCRIPT> tag to print details registration in next page.
5. Specify the form by using the <FORM> tag and specify the name for the form.
6. Create the table by using the <TABLE> tag.
7. Specify the number of rows by using <TR> tag.
8. Specify the data for the table by using <TD> tag.
9. Specify the column heading by using <TH> tag.
10. Add the <OPTION> tag to select the state, caste.
11. Close the <FORM> tag.
12. Close all the tags.
Coding:
<html>
<head>
<title> Birth certificate Form </title>
<script language="javascript"type="text/javascript">
function namevalidate()
{document.writeln("</tr> Name:"+document.a.name.value+"<br>");
document.writeln("</tr> FatherName:"+document.a.f.value+"<br>");
document.writeln("</tr> MotherName:"+document.a.m.value+"<br>");
for(var i=0;i<=document.a.sex.length;i++)
{if(document.a.sex[i].checked)
{document.writeln("Sex :"+document.a.sex[i].value+"<br>");
break;
} }
document.writeln("</tr> Address:"+document.a.address.value+"<br>");
for(var i=0;i<=document.a.religion.length;i++)
{if(document.a.religion[i].checked)
{ document.writeln("Religion
:"+document.a.religion[i].value+"<br>");
break;
}}document.writeln("</tr> Birth Place:"+document.a.birth.value+"<br>");
document.writeln("</tr> Birth Date:"+document.a.place.value+"<br>");
document.writeln("</tr> Cast:"+document.a.cast.value+"<br>");
document.writeln("</tr><h3> you have successfully registered for birth certificate details
</h2>");
}</script>
</head>
<body bgcolor="pink" Birth Certificate>
<form name="a">
<table>
<tr >
<td><p> <B> Name: <B></td>
<td> <input type="text" name="name"></td>
</tr>
<tr>
<td>
<p> Father Name:</td><td> <input type="text" name="f"></td>
</tr>
<td><p> Mother Name: </td><td><input type="text" name="m"></td>
</tr>
<tr>
<td><p> Gender: <td><input type="radio" name="sex" value="Male">Male <input
type="radio" name="sex" value="Female">Female<br> </td>
</p></tr><tr>
<td> <p> Resediential Address: <td><textarea roes="4" cols="25"
name="address"></textarea></td></p>
</td></tr><td><p> Religion: </td><td>
<input type="radio" name="religion" value="Hindu">Hindu
<input type="radio" name="religion" value="Christian">Christian
<input type="radio" name="religion" value="Muslim">Muslim
<input type="radio" name="religion" value="Others">Others</td>
</tr><tr><td><p> Birth Date:<td> <input type ="number" name="birth"></td></p>
</td></tr><tr><td><p> Birth Place:<td>
<select name="place">
<option> Puducherry </option>
<option> Tamilnadu</option></select> </td>
</tr>
<tr><td><p> Cast: <td><select name="cast">
<option> MBC </option>
<option> OBC</option>
<option> SC </option>
</select></td>
</tr></p></table><p><input name="button2" type="button" value="Submit" onclick="
namevalidate()">
<input name="button" type="button" value="Reset" >
</form></body></html>
OUTPUT:

Result:
Thus registration form is designed using java script &HTML tag and the output is verified.
Aim:
To design an HTML document to implement the built in function using vb script.
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. Specify the form by using the <FORM> tag and specify the name for the form.
5. Add the <INPUT> tag to retrieve data from the user.
6. Include the <SCRIPT> tag to include the script language as VbScript.
7. Get the user input in an inputbox and perform a string operation like lowercase,
uppercase, length, reverse using a build in function. Display the output.
8. Display the today date and current time using the build in data/time function.
9. Get the user input in an inputbox and perform a mathematical function like log, sin, cos,
tan using build in function. Display the appropriate output.
10. Close all the tags.
Coding:
<Html>
<head>
<title>Built-in Functions in VBScript</title>
<Script type="Text/vbscript">
sub operation(a)
if a=1 then
msgbox("LowerCase of Given String is "&LCase(st.str.value))
elseif a=2 then
msgbox("UpperCase of Given String is "&UCase(st.str.value))
elseif a=3 then
msgbox("Length of Given String is "&Len(st.str.value))
elseif a=4 then
msgbox("Reverse of Given String is "&StrReverse(st.str.value))
elseif a=5 then
msgbox(Now)
elseif a=6 then
msgbox(Date)
elseif a=7 then
msgbox("The Log value of the given Number is"&Log(st.num.value))
elseif a=8 then
msgbox("The Sin value of the given Number is"&Sin(st.num.value))
elseif a=9 then
msgbox("The Cos value of the given Number is"&Cos(st.num.value))
elseif a=10 then
msgbox("The Tan value of the given Number is"&Tan(st.num.value))
End if
end sub
</Script>
</head>
<body bgcolor="cyan">
<form name="st">
<h1 align="center">Built-in Functions in VBScript</h1>
<h2>String Functions</h2>
<b>Enter a String:</b>
<input type="text" id="str"><br>
<br><input type=button value="Lower" onclick="operation(1)">
<input type=button value="Higher" onclick="operation(2)">
<input type=button value="Length" onclick="operation(3)">
<input type=button value="Reverse" onclick="operation(4)">
<br/><br/>
<h2>Date/Time Functions</h2>
<input type=button value="Date" onclick="operation(5)">
<input type=button value="Now" onclick="operation(6)">
<h2>Math Functions</h2>
<b>Enter a Number:</b>
<input type="text" id="num"><br>
<br><input type=button value="Log" onclick="operation(7)">
<input type=button value="Sin" onclick="operation(8)">
<input type=button value="Cos" onclick="operation(9)">
<input type=button value="Tan" onclick="operation(10)">
</form>
</body>
</Html>
Output:
Result :
Thus built in function using java script is implemented and executed successfully
Aim
To develop functional and procedural methods using VB Script in designing a web page.
Algorithm
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section.
4. Include the appropriate VBScript definitions using the <SCRIPT> tag. Create procedure
and function to get input from user.
5. Include <BODY> tag to enclose all the tags.
6. Enter the user name then click ok to print name in user page.
7. Close all the tags.
8. Run the code in internet explorer.
Source Code:
<html><head>
<script language="vbscript">
sub inputext
Dim a,b,dis
a="Hello Welcome. Please enter your name:"
b="just for your name"
dis=InputBox(a,b)
document.write("your name is :" &dis)
End sub
</script></head>
<body onload=inputext>
<form></form></body></html>
FUNCTIONS:
<html><head>
<script language="vbscript">
public function inputext
Dim a,b,dis
a="Hello Welcome. Please enter your name:"
b="just for your name"
dis=InputBox(a,b)
document.write("your name is :" &dis)
End function
</script></head>
<body onload=inputext>
<form></form>
</body></html>
Output

RESULT:

Thus a web page is developed using Functions and procedures in VB Script and the
output is verified.
AIM
To study the configuration of

i. Internet Information Server (IIS) and

ii. Apache Web Server.

INTERNET INFORMATION SERVER(IIS):


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

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.
Click OK.

6. 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:

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.

1. 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.

2. Verify that each of your IIS websites has a virtual directory called JRunScripts.
The following figure shows a sample JRunScripts virtual directory:
3. 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,set and, and they are done. 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 JDK

Your 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 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 Tomcat

Configuring 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 Software

Go to 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 for notes on the differences between the
two.Alternatively, you can use my.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.

2. Set the JAVA_HOME Variable

Next, 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,
thenEnvironment. 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 80

Assuming 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 Reloading

The 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.

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 Servlet

The 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. 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 applicationlass>

</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
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.t>

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

If 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.
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).
RESULT:

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

Create a webpage with ActiveX controls using OBJECT and PARAM tags.
Algorithm:
1. In HTML OBJECT and PARAM tags are used to insert ActiveX controls in Web page.
2. The OBJECT WIDTH specifies the width of a box enclosing the visible area of the
object. Use width instead of accessing the Width property.
3. The HEIGHT specifies the height of a box enclosing the visible area of the object. Use
height instead of accessing the Height property.
4. The TYPE specifies the Internet Media Type of the data specified by the DATA attribute.
Since this information can be accessed before the data is retrieved, it is possible to skip
over unsupported media types
5. The DATA indicates that the value is to be passed directly to the object as a string.
6. The CLASSID specifies a URL used to locate the object, or it specifies a class identifier
for the object. For ActiveX controls, CLASSID is used to specify the class identifier. The
class identifier is a unique alphanumeric code assigned to each ActiveX control and is
stored in the system Registry of the client computer
7. The PARAM tag to assign a value to a named property within the control. need to use
only the NAME and VALUE attributes.
8. The NAME specifies the property name.
9. The VALUE specifies the value for the named property.
10. The <embed> tag defines a container for an external application or interactive content (a
plug-in).
11. Save the HTML file and open in browser such Internet Explorer ,Mozilla Firefox etc..
Code:
<!DOCTYPE html>
<html>
<body>
<center> <b> <h2> ActiveX Controls in web documents</h2></b></center>
<object width="100%" height="100%"
type="video/x-ms-asf" url="10a.wmv" data="10a.wmv"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="url" value="10a.wmv">
<embed type="application/x-mplayer2" src="10a.wmv" width="100%" height="100%"
autostart="true" showcontrols="true"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
</object></body></html>
Output:

Result:

Thus webpage with ActiveX controls implemented and executed successfully.


Aim:
Create Book advisor Application using MVC architecture. In the application user is first
presented with a choice in Book subject prefers. Pressing a button moves on to a page with
advise about the type of book based on that subject.

Algorithm:

1. Create MVC application has three parts:


2. Model: The model is the domain-specific representation of the data upon which the
application operates. In our case this is implemented in the BookExpert class.
3. View: The view renders the model into a form suitable for interaction, typically a user
interface element. In our case this is implemented in a JSP file called Book.jsp.
4. Controller: The controller receives input and initiates a response by making calls on
model objects. In our case this is implemented in the BookSelect class.
5. In addition to these three file we need a web.xml file that tells the container how to map a
URL (e.g. /bookSelect.do) into a class to run (e.g. com.example.web.bookSelect).
6. We also need a start page for the user input, which we will call book.html. In total this
means we should create a .war file .

Code:

Book.html

<html>
<body>
<h2><u><center>Book Advisor Input</center></u></h2>
<form method="POST" action="BookSelect.do">
<select name="taste" size=1">
<option value="DBMS">DBMS</option>
<option value="Software Engineering"> Software Engineering</option>
<option value="Web Technology">Web Technology</option>
<option value="Wireless Communication">Wireless Communication</option>
</select>
<br/><br/>
<input type="Submit"/>
</form>
</body>
</html>
BookExpert.java
package com.example.model;
import java.util.*;
public class BookExpert {
public List<String> getTypes(String taste) {
List<String> result = new ArrayList<String>();
if (taste.equals("DBMS")) {
result.add("Database System Concepts by Abraham Silberschatz");
result.add("Modern Database Management by Addison-Wesley");
} else if (taste.equals("Software Engineering")) {
result.add("Software Engineering by Ian Sommerville");
result.add(" Software Engineering by Roger S. Pressman");
} else if (taste.equals("Web Technology")) {
result.add("Internet and World Wide Web How to Program by Deitel and Deitel,
Goldberg,");
result.add("Web Technology by Rajkamal");
result.add("Active X from the Ground Up by John Paul Mueller");
result.add("Understanding Web Services: XML, WSDL, SOAP, and UDDI by Eric
Newcome");
} else if (taste.equals("Wireless Communication")) {
result.add("Wireless Communications and Networks by William Stallings");
} else {
result.add(" Wireless Communications by Theodore S. Rappaport");
}
return (result);
}
}

BookSelect.java

package com.example.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.example.model.BookExpert;

public class BookSelect extends HttpServlet {


private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {
List<String> types = new BookExpert().getTypes(request.getParameter("taste"));
request.setAttribute("types", types);
RequestDispatcher view = request.getRequestDispatcher("book.jsp");
view.forward(request, response);
}
}

book.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<body>
<h2>Book Advisor Output</h2>
<c:forEach var="type" items="${types}">
<c:out value="${type}"/>
<br / >
</c:forEach>
</body>
</html>

web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>


<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-
app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Book</servlet-name>
<servlet-class>com.example.web.BookSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Book</servlet-name>
<url-pattern>/BookSelect.do</url-pattern>
</servlet-mapping>
</web-app>
Output
Choice in book

Result:
Thus successfully Book advisor Application implemented using MVC architecture and output is
verified.
Aim:
Create a JSP program to display the session id as well as the count which shows how
many times the page is accessed during the current session.
Algorithm:
1. The session object is an instance of Http Session.It used to track information about a
particular client. Each client has one global session object.
2. When user send the fist request to the JSP engine it will issue a session id to track the
information for the transaction. The JSP engine exposes the HttpSession object to the JSP
through the session object. The current session information collected following some of
methods available through session object
3. Use getCreationTime() method to return the time when the session was created and it is
measured in milliseconds .
4. Use getLastAccessedTime() method to returns the last time the client sent a request
associated with the session, as the number of milliseconds.
5. Use getAttribute(String name) method to return the object bound with the specified
name in the session, or null if no object is bound under the name
6. Use setAttribute(String name, Object value) method to binds an object to this session,
using the name specified.
7. Save code as session.jsp and run code, at first run Number of visits of page is 0 and it is
incremented at second run.
Code:
Session.jsp
<%@ page import="java.io.*,java.util.*" %>
<%
// Get session creation time.
Date createTime = new Date(session.getCreationTime());
// Get last access time of this web page.
Date lastAccessTime = new Date(session.getLastAccessedTime());
String title = "Welcome Back to my website";
Integer visitCount = new Integer(0);
String visitCountKey = new String("visitCount");
String userIDKey = new String("userID");
String userID = new String("ABCD");
// Check if this is new comer on your web page.
if (session.isNew()){
title = "Welcome to my website";
session.setAttribute(userIDKey, userID);
session.setAttribute(visitCountKey, visitCount);
} visitCount = (Integer)session.getAttribute(visitCountKey);
visitCount = visitCount + 1;
userID = (String)session.getAttribute(userIDKey);
session.setAttribute(visitCountKey, visitCount);
%>
Output

Result:

Thus program is implemented and it displays the session id and shows how many times
the page is accessed during the current session.
Aim:
Create a JSP program to display university results of students according to their register
No. and department.
Algorithm:
1. Create a result.jsp page which display university result page where student provide
register number and department information to know their results.
2. Create a table stud1.mdb to store students result information using msacess.
3. Create search.jsp to create database access connection.
4. After creating database connection search.jsp is linked with result.jsp.
5. Save search.jsp and result.jsp.
6. Run result.jsp.
Code:
Result.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Search result</title>
</head>
<body BGCOLOR="PINK">
<form name="form" method="post" action="ser.jsp" onsubmit="javascript:return validate();">
<H2><center> UNIVERSITY RESULTS </center></h2>
<center>
<table>
<tr>
<td>Register no:</td>
<td><input type="text" name="tr1" size="10" /></td></tr>
<TR>
<td>Course Category:</td>
<td><select name="tr1">
<option value="-1">-Select Category-</option>
<option value="CSE">B.TECH(CSE)</option>
<option value="ece">B.TECH(ECE)</option>
<option value="it">B.TECH(IT)</option>
<option value="mech">B.TECH(MECH)</option>
</select></td>
<td><input type="submit" value="RESULT" /></td>
</tr>
</table>
</center>
</form>
</body>
</html>
Search.jsp

<%@page import="java.sql.Connection"%>
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"
errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head><body>
<%String tr1 =request.getParameter("tr1");
String tr2 =request.getParameter("tr2");
try {
Connection connection = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:ni1");
Statement statement = connection.createStatement();
statement = connection.createStatement();
String QueryString = "select * from stud1 where register="+tr1+" and "+tr2+" " ;
ResultSet rs = statement.executeQuery(QueryString);
int count=0;
out.print("<CENTER>");
out.print("<H2>RESULT</H2>");
out.println("<TABLE border=1 cellpadding=15 style=background-color:PINK> <TR>
<TH>register</TH> <TH>name</TH> <TH>course</TH><TH>SE</TH>
<TH>DBMS</TH><TH>WT</TH></tr>");
while(rs.next())
{ out.println("<tr><td>" + rs.getInt(1) + "</td> <td>" + rs.getString(2) +
"</td><td>" + rs.getString(3) + "</td> <td>" + rs.getString(4) + "</td> <td>" + rs.getString(5) +
"</td><td>" + rs.getString(6) + "</td></tr>")count++;
} out.println("</table>");
out.print("<CENTER>");
{//out.println("Unable to connect to database.");
}} catch (Exception ex)
{out.println(ex);
}%></body></html>
Output:

Result:

Thus database connection created and student result also displayed successfully.
a)Reading Text File

Aim:
Create JSP program to manipulate file related task such as reading text file, checking file type .
Algorithm:

1. Create a text file name jsp.txt and put in same folder where fileRead.jsp jsp file is exists.
2. The getServletContext().getRealPath("/") method is used to get the absolute path of
jsp.txt jsp file.
3. The FileInputStream class is used to read bytes from file jsp.txt
4. The BufferedInputStream class buffering to input streams. Buffering used read a larger
block at a time.
5. The readLine() method is used to read the data line by line.
6. To check file exists , directory, or file using method f.exists(),f.isDirectory(), and
f.isFile()
7. The close() method is used to close file.
Code:
Reading text file in JSP
fileRead.jsp
<%@ page language="java" import="java.io.*" errorPage="" %>
<html>
<head>
<title>File Handling in JSP</title>
</head>
<body>
<h2><u><center>Reading text file in JSP </center></u></h2>
<%
String fileName=getServletContext().getRealPath("jsp.txt");
File f=new File(fileName);
InputStream in = new FileInputStream(f);
BufferedInputStream bin = new BufferedInputStream(in);
DataInputStream din = new DataInputStream(bin);
while(din.available()>0)
{
out.println(din.readLine());
out.print("<br>");
}
in.close();
bin.close();
din.close();
%></body></html>
INPUT - Jsp.txt

Output:
(b) Checking file type for existing, file or as directory

fileType.jsp

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


<html>
<head>
<title>File Handling in JSP</title>
</head>
<body>
<%String fileName=getServletContext().getRealPath("jsp.txt");
File f=new File(fileName);
out.print("File exists : "+f.exists()+"<br>");
out.print("File is File : "+f.isFile()+"<br>");
/// return type is boolean exists return true else false
%></body></html>

Output:

Result:

Thus JSP program to manipulate file as reading text file, checking file type is
implemented and executed successfully.
Aim:
create Ajax program using JSP to display name with hello message.
Algorithm:
1. Ajax is the method of using Javascript, DHTML
2. The XMLHttpRequest object Right-click on WebContent and click New=>JSP file and
create hello.html
3. Right-click on WebContent and click New=>File file and create hello1.jsp
4. Create an XML HttpRequest object to perform a GET or POST and return a result
without reloading the HTML page.
5. Create the function to be executed when the server response is ready
6. Send the request off to a file on the server
7. Notice that a parameter (q) is added to the URL (with the content of the input field)
8. Save hello.html and hello1.jsp.
9. Run hello.html. and Enter your name and click Go button Then it displays name with
hello message
Code:
Ajax.html
<html>
<head>
<title>Simple Ajax Example</title>
<script language="Javascript">
function xmlhttpPost(strURL) {
var xmlHttpReq = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
updatepage(self.xmlHttpReq.responseText);
}
}
self.xmlHttpReq.send(getquerystring());
}
function getquerystring() {
var form = document.forms['f1'];
var word = form.word.value;
qstr = 'w=' + escape(word); // NOTE: no '?' before querystring
return qstr;
}
function updatepage(str){
document.getElementById("result").innerHTML = str;
}
</script>
</head>
<body bgcolor="pink">
<center> <h2> Ajax Programming </h2></center>
<form name="f1">
<center>
<p>Enter your name: <input name="word" type="text">
<input value="Go" type="button" onclick='JavaScript:xmlhttpPost("hello1.jsp")'></p></center>
<div id="result"></div>
</form>
</body>
</html>

Hello1.jsp
<%@ page language="java" contentType="application/x-www-form-urlencoded; charset=ISO-
8859-1"
pageEncoding="ISO-8859-1"%>
<%
String w = request.getParameter("w");
String msg = "Hello "+w;
%>
<%=msg%>
Output:

Result:

Thus Ajax program is implemented and executed successfully.


Aim:
Create student registration form using java servlets
Alogrithum:

1. Creating New Project Goto File->New Project ( One window will open)
2. In Project Window , Select Web -> Web Application and Select Next
3. Enter the Name of the Project [Eg. MyServlet] , Select Next and Select finish
4. Create HTML file and Right click on the Web Pages Folder
5. Select New -> HTML option from the pop up window.
6. Type the name of html page as REGISTER.HTML. Finish the wizard.
7. Now Create new table name as LoginDetail with field need for contact form
8. Creating Servlet Right click on the Source Package Folder
9. Select New -> Servlet option from the pop up window.
10. Type the name of servlet as RegisterServlet.java and Finish the wizard.
11. Run the project. As URL => http://localhost:8084/MyServlet/select.html
12. Now Enter the details and and Submit it. Message box will come that you successfully
insert data in database .
Code:
REGISTER.HTML
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<CENTER> <h2> <b> Registration form for student </b> </h2></center>
<body bgcolor="lavender">

<form method="get" action="registerServlet">


<center>
<PRE>
Name <input type="text" name="txtName"><br>
Dob <input type="text" name="dob"><br>
Address <input type="text" name="ad"><br>
Age <input type="text" name="age"><br>
Fathername <input type="text" name="fa"><br>
mothername <input type="text" name="mo"><br>
Father's occupation <input type="text" name="fao"><br>
mother's occupation <input type="text" name="moc"><br>
school <input type="text" name="s"><br>
10th <input type="text" name="t"><br>
12th <input type="text" name="tt"><br>
<input type="submit" value="submit"></center>
</pre>
</form>
</body>
</html>

RegisterServlet.java

import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author Administrator
*/
@WebServlet(name = "registerServlet", urlPatterns = {"/registerServlet"})
public class registerServlet extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/

//PrintWriter out = response.getWriter();


public void doGet(HttpServletRequest request,HttpServletResponse response) throws
ServletException,IOException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String name=request.getParameter("txtName");
String dob=request.getParameter("dob");
String address=request.getParameter("ad");
String age=request.getParameter("age");
String fathername=request.getParameter("fa");
String mothername=request.getParameter("mo");
String fatheroccupation=request.getParameter("fao");
String motheroccupation=request.getParameter("moc");
String school =request.getParameter("s");
String tenth=request.getParameter("t");
String tw=request.getParameter("tt");

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:nit");
PreparedStatement stmt=con.prepareStatement("insert into LoginDetail
values(?,?,?,?,?,?,?,?,?,?,?)");
stmt.setString(1, name);
stmt.setString(2,dob );
stmt.setString(3, address);
stmt.setString(4,age );
stmt.setString(5,fathername );
stmt.setString(6, mothername);
stmt.setString(7, fatheroccupation);
stmt.setString(8, motheroccupation);
stmt.setString(9, school);
stmt.setString(10,tenth );
stmt.setString(11,tw );
int i=stmt.executeUpdate();
out.println("<h1><center>You are successfully Registered!</center</h1>");
con.close();
}

catch(Exception e)
{
out.println("<b>Registration failed</b>");
out.println("<b>Error:</b>" +e);
}
}
}
Output

Result
Thus student registration form implemented and executed successfully using javaservlet.
Aim:
Create a PHP program to register basic contact information.
Algorithm:
1. Install Wamp Server On PC. .
2. Now Start the Wamp Server and do right click and click on phpmyadmin .
3. PhphMyadmin page will open and clikck on New database and create new database with
name stud1
4. Now Create new table name as info with field need for contact form
5. Now Create Web page to get contact information
6. Create Php File Which Handle that request and save this file as insert1.php.
7. Put this both file in single Folder and Put this folder in Wamp installation directory,
inside WWW folder defalut path is C:\wamp\www\
8. Now again do right click and click on local host . Main Page of wampserver will open.
9. Now Contact1.html page will open.
10. Now Enter the details and and Submit it. Message box will come that you successfully
insert data in database
Code:
Contact1.html
<html>
<head>
</head>
<body bgcolor="Bisque">
<CENTER><h2>CONTACT FORM </h2></CENTER>
<CENTER>
<form action="insert1.php" method="post"><pre>
<B>
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
Email id: <input type="text" name="email"><br>
TelePhone No:<input type="text" name="tele"><br>
Address: <input type="text" name="addr"></pre>
<input type="Submit">
</B>
</CENTER>
</form>
</body>
</html>

Insert1.php( Php File Which Handle that request)


<?php
$database="stud1"; //database name
$first=$_POST['first'];//this values comes from html file after submitting
$last=$_POST['last'];
$email=$_POST['email'];/
$tele=$_POST['tele'];
$addr=$_POST['addr'];
$con = mysql_connect("localhost","root" ,"");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);

$query = "INSERT INTO info1


(first,last,email,tele,addr)VALUES('$first','$last,'$email,$tele,$addr)";
mysql_query($query);
echo "<script type='text/javascript'>\n";
echo "alert('you are Succesflly registered');\n";
echo "</script>";
OUTPUT

Result:
Thus contact form is implemented and executed using php
AIM: Create login page validation in asp
Algorithm:
1. Start the Process.
2. Include <HTML> tag to identify it as a HTML document.
3. Include a title for the document using <TITLE> Tag in head section
4. Add the <INPUT> tag to retrieve data from the user.
5. Include the appropriate ASP script definitions using the <% ....% > tag. Used to validate
the login form.
6. Close all the tags.
Source Code:
<%
'Green colorset
'BackgroundColor="#C9DDB3"
'BorderColor="#006600"
'Blue colorset
BackgroundColor="#AFD1F8"
BorderColor="#000080"
'Purple colorset
'BackgroundColor="#FDC8F2"
'BorderColor="#800080"
Content = ""'Clear the Content string
QStr = Request.QueryString("login") 'Save the login querystring to QStr
if ucase(left(QStr,6))="CREATE" then
Title = "Register"
else
Title = "Login"
end if

'The code below saves the contents the table must have in the variable Content
'The content depends on what's in the QueryString

if QStr="passfailed" then
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><P>Wrong password</P><A href=Javascript:history.go(-1)>Back</A></td></tr>"
elseif QStr="createpassfailed" then
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><P>Wrong password</P><A href=Javascript:history.go(-
1)>Back</A><BR><BR><A HREF=login.asp>Cancel registration</A></td></tr>"
elseif QStr="namefailed" the Content = Content & "<tr><td valign=top bordercolor="&
BackgroundColor &" align=center><P>Invalid username</P><A
HREF=login.asp?login=createnew>Click here to create an acount</A><BR><BR><A
HREF=Javascript:history.go(-1)>Back</A></td></tr>"
elseif QStr="createnamefailed" then
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><P>Invalid username</P><A HREF=Javascript:history.go(-
1)>Back</A><BR><BR><A HREF=login.asp>Cancel registration</A></td></tr>"
elseif QStr="creatednew" then
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><P>Your account has been created</P><A
HREF=login.asp>Login</A></td></tr>"
elseif QStr="createnew" then
Content = Content & "<form name=frmCreate method=POST
action=create.asp>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><br>Username: <input type=text name=txtUsername></td></tr>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center>Password: <input type=password name=txtPassword></td></tr>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><br>Full name: <input type=text name=txtFullname></td></tr>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><input type=submit name=cmdSubmit value=Register></td></tr>"
Content = Content & "</form>"
else
Content = Content & "<form name=frmMain method=POST action=verify.asp>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><br>Username: <input type=text name=txtUsername></td></tr>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center>Password: <input type=password name=txtPassword></td></tr>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><input type=submit name=cmdSubmit value=Login></td></tr>"
Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &"
align=center><input type=submit name=cmdSubmit value=Register></td></tr>"
Content = Content & "</form>"
end if%><!-- Build the page with the table -->
<head> <title>ASP Login</title>
</head><body link="<% Response.Write(BorderColor) %>" vlink="<%
Response.Write(BorderColor) %>" alink="<% Response.Write(BorderColor) %>" text="<%
Response.Write(BorderColor) %>"><br><div align="center">
<table border="2" cellspacing="5" bgcolor="<% Response.Write(BackgroundColor) %>"
bordercolor="<% Response.Write(BorderColor) %>"width="250px">
<% Response.Write("<tr><td valign=top align=center><b>" & Title &
"</b></td></tr>")
Response.Write(Content) ' Paste the contents in the table
%>
</table></div></body>
OUTPUT: http://localhost/Login_and_54210292002/login.asp

Successful login page


Database: uselist.mdb

Result:
Thus login page validation is created and executed in asp
Problem Description:
The development of pharmacy helps the users to purchase different types of medicines
and also to view the medicine through online itself.
The website consists of details such as
1. Home
2. Login
3. Registration
4. Available medicine
5. Help
Project explanation:
The online Pharmacy is business-to-consumer electronic commerce is the most visible
business use of the World Wide Web. The primary goal of an e-commerce site is to sell
medicines and services online. This project deals with developing an e-commerce website for
Online Pharmacy Sale. It provides the user with different types of medicines available for
purchase. In order to facilitate online purchase a medicines is provided to the user. The system is
implemented using a 3-tier approach, with a backend database, a middle tier of a jsp and
javaservlet, and a web browser as the front end client.
Software Requirements
The Pharmacy application is implemented using the Net Beans IDE 7.1.0 tool, dynamic
web page are created using programming JSP and to store and retrieve data its connected with
MicrosoftAcess2003.
Modules Description
A small description of various modules used in this project is as follows,
Login Form:
The login form is the first module which helps the user in getting access to the system
functions.
Registration form:
The next form is the registration form. Here the user has to enter his or her details and
this helps in maintaining history of that particular person.
Available medicine
This page help user to check whether medicine available in pharmacy.
Database:
The database serves as a storage house in storing the medical name and availability and
other aspects related to the project.
Implementation
Source Code:
Main.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link href="style.css" rel="stylesheet" type="text/css"> </link>
</head>
<body>
<div id="container">
<div id="header"> <img src="images/ilogo.jpg" alt="" id="logo">
<h1 id="logo-text">Pharmacy</h1>
</div>
<div id="nav">
<ul>
<li><a href="index.jsp">Home</a></li>
<li><a href="login.jsp">Log&nbsp;In </a></li>
<li><a href="reg.jsp">Registeration&nbsp;</a></li>
<li><a href="avi.jsp">Available medicine</a></li>
<li><a href="1help.html">Help</a></li>
</ul>
</div>
<div id="site-content">
<div id="col-left">
<h1 class="h-text-1">WELCOME</h1><p class="text-1"><strong> Pharmecy will show the
detail of medican which are availble</p>
<ul class="list-1">
<li>A malaria is treated by giving chloroquine, pirmaquire and paracetamal tablets.</li>
<li>Antihistamines - stop runny noses and sneezing.</li>
<li>Pain relievers - ease fever, headaches, and minor aches and pains.</li>
</ul>
<p class="border-1">&nbsp;</p>
<h2 class="h-text-2">About us</h2>
<p class="text-1">Pharmacists and chemists play a key role in providing quality healthcare to
patients. Working in the community, primary care and hospitals, pharmacists use their clinical
expertise together with their practical knowledge to ensure the safe supply and use of medicines
by patients and members of the public
</p>
<p class="text-1">Pharmacists offer advice on common problems such as coughs, colds, aches
and pains, as well as healthy eating and stopping smoking. </p>
</div>
<div id="col-right">
<div style="padding: 30px 10px 10px;">
<h2 class="h-text-2">Latest News</h2>
<h3 class="h-text-3">Available Medican</h3>
<p class="text-2"><b>DEXTROMETHORPHAN<b>
Dextromethorphan is an over-the-counter cough suppressant that works by affecting the
portion of the human brain associated with coughing. It is found in most cold remedies and
cough medicines, and is sold as a liquid or capsule.
</p>
</div>
<div>&nbsp;</div>
<div style="padding: 5px 10px;">
<h2 class="h-text-2">Contact </h2>
</div>
<div
style="padding: 5px 10px 15px; background: rgb(216, 214, 215) none repeat scroll 0%; -moz-
background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy:
initial;">
<p class="text-2"> Pharmecy East Coast rode Puducherry<br>
<br>
E-mail: [email protected]<br>
<br>
Website: www.Pharmecy.com<br>
<br>
Phone: 9847854612<br>
</p>
</div>
</div>
</div>
</body>
</html>

Login.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<script>
function validate(){
var username=document.form.user.value;
var password=document.form.pass.value;
if(username==""){
alert("Enter Username!");
return false;
}
if(password==""){
alert("Enter Password!");
return false;
}
return true;
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body bgcolor="fuchia">
<center>
<h3> Enter username and Password</h3>
<form name="form" method="post" action="loginvalid" onsubmit="javascript:return
validate();">
<table>
<tr><td>Username:</td><td><input type="text" name="user"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</center>
</body>
</html>

Loginvalid.java:

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
import javax.servlet.RequestDispatcher;
/**
*
* @author INDRAJITH
*/
@WebServlet(name = "loginvalid", urlPatterns = {"/loginvalid"})
public class loginvalid extends HttpServlet
{
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
String userName = request.getParameter("user");
String password = request.getParameter("pass");
//out.println("user name:" +userName);
//out.println("password:" +password);
if(login(userName, password)){
out.println(" Login is Successful ................");
//RequestDispatcher rd = request.getRequestDispatcher("Anotherservlet");
//rd.forward(request, response);
//cmd box
}
else {
out.println("Login Failed. Please Login Again..................");
//RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
// rd.forward(request, response);
}
}
boolean login(String userName, String password) {
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:pharm");
System.out.println("got connection");
Statement s = con.createStatement();
String sql = "SELECT * FROM login" +
" WHERE Username='" + userName + "'" +
" AND Password='" + password + "'";
ResultSet rs = s.executeQuery(sql);
if (rs.next())
{
rs.close();
s.close();
con.close();
return true;
}
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e)
{
System.out.println(e.toString());
}
catch (SQLException e)
{
System.out.println(e.toString());
}
catch (Exception e)
{
System.out.println(e.toString());
}
return false;
}
}

Reg.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body bgcolor="burlywood">
<center>
<ul>
<li><a href="pur.jsp"><h4>Purchase the medicine</h4></a></li>
<li><a href="mail.html"><h4>View the details of medicine</h4> </a></li>

</ul> </center>
</body>
</html>

Pur.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body bgcolor="gainboro">
<center>
<h4> Enter Your Details </h4>
<form method="get" action="registerservelet ">
<tr><label><p>Name
<input type="text" name="Name" id="Name" /></p>
</label></tr>
<tr><label><p>Password
<input type="text" name="Password" id="Password" /></p>
</label></tr>
<tr><label><p>Address
<textarea name="Address" id="Address" cols="45" rows="5"></textarea></p>
</label></tr>
</tr><label><p>Contact
<input type="text" name="Contact" id="Contact" /></p>
</label>
</tr>
<label>
<input type="submit" value="Submit" />
</label><br>
</form>
<center>
</body>
</html>

Registerationservelet.java:

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.sql.*;
/**
*
* @author INDRAJITH
*/
@WebServlet(name = "registerservelet", urlPatterns = {"/registerservelet"})
public class registerservelet extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String Name=request.getParameter("Name");
String Password=request.getParameter("Password" );
String Address=request.getParameter("Address");
String Contact=request.getParameter("Contact");
try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:pharm");
PreparedStatement stmt=con.prepareStatement("insert into Purchase values(?,?,?,?)");
stmt.setString(1, Name);
stmt.setString(2, Password);
stmt.setString(3, Address);
stmt.setString(4, Contact);
int i=stmt.executeUpdate();
out.println("You are Successfully Registered");
con.close();
}
catch(Exception e)
{
out.print("Registeration Failed");
out.println("Error:" +e);
}
}
}

View.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="hotpink">
<center>
<h3> Available Medicine Details </h3>
<h4> <b>Click the Button to view the Medicine Details </b></h4>
<form name="f" method="post" action="a.jsp">
<input type="submit" value="View">
</form>
</center>
</body>
</html>

a.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body bgcolor="lightpink">
<%@page language="java" %>
<%@page import="java.sql.*;" %>
<%
Statement s=null;
Connection cn=null;
ResultSet rs=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:pharm");
s=cn.createStatement();
String str="select * from medicine";
rs=s.executeQuery(str);
while(rs.next())
{
out.println("Name of medicine: " +rs.getString(1)+"<br>");
out.println("Available Quantity: " +rs.getInt(2)+"<br>");
out.println("Manufacture Date: " +rs.getString(3)+"<br>");
out.println("Expire Date: " +rs.getString(4)+"<br>");
out.println("<hr>");
}
s.close();
cn.close();
%>
</body>
</html>
Avi.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<script>
function validate()
{
var Name=document.form.user.value;
if(Name=="")
{
alert("Enter the name");
return false;
}
return true;
}</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="peachpuff">
<center>
<form name="form" method="post" action="searchvalid" onsubmit="javascript:return
validate();">
<tr> <h2>Search for medicine </h2> </tr>
<td> <p><B> Enter the medicine Name:</b></p></td>
<td> <input type="text" name="Name"></td>
<input type="submit" value="Submit">
</form>
</center>
</body>
</html>

Searchvalid.java:

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
/**
*
* @author INDRAJITH
*/
@WebServlet(name = "searchvalid", urlPatterns = {"/searchvalid"})
public class searchvalid extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();

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

//out.println("user name:" +userName);


//out.println("password:" +password);
if(search(Name)){
out.println("Medicine is Availble");
//RequestDispatcher rd = request.getRequestDispatcher("Anotherservlet");
//rd.forward(request, response);
//cmd box
}
else {
out.println("Medicine is Not Availble. Again Later..................");
//RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
// rd.forward(request, response);
}
}
boolean search( String Name) {
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:pharm");
System.out.println("got connection");
Statement s = con.createStatement();
String sql = "SELECT * FROM available" +
" WHERE Name='" + Name + "'";
ResultSet rs = s.executeQuery(sql);
if (rs.next())
{
rs.close();
s.close();
con.close();
return true;
}
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e)
{
System.out.println(e.toString());
}
catch (SQLException e)
{
System.out.println(e.toString());
}
catch (Exception e)
{
System.out.println(e.toString());
}
return false;
}
}

Card.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body bgcolor="lightblue">
<center>
<h3>Enter the details</h3>
<form id="form1" name="form1" method="get" action=" createcard">
<table>
<tr><td>Customer Name</td><td><input type="text" name="textfield" /></td></tr>
<tr><td>Address </td><td><input type="text" name="textfield2" /></td></tr>
<tr><td>City</td><td><input type="text" name="textfield3" /></td></tr>
<tr><td>State</td><td><input type="text" name="textfield4" /></td></tr>
<tr><td>Pin code</td><td><input type="text" name="textfield5" /></td></tr>
<tr><td>Phone no</td><td><input type="text" name="textfield6" /></td></tr>

<tr><td>E-mail</td><td><input type="text" name="textfield7" /></td></tr>

<tr><td>Card type</td><td><select name="select">


<option>Credit card</option>
<option>Pan card</option>
</select></td></tr>

<tr><td> Credit card no</td><td><input type="text" name="textfield8" /></td></tr>


<tr><td>Expire date</td><td><input type="text" name="textfield9" /></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</body>
</html>
Createdcard.java
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author INDRAJITH
*/
@WebServlet(name = "createcard", urlPatterns = {"/createcard"})
public class createcard extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

String CustomerName=request.getParameter("textfield");
String Address=request.getParameter("textfield2" );
String City=request.getParameter("textfield3");
String state=request.getParameter("textfield4");
String zipcode=request.getParameter("textfield5");
String phoneno=request.getParameter("textfield6" );
String Email=request.getParameter("textfield7");
String Cardtype=request.getParameter("select");
String Creditcardnumber=request.getParameter("textfield8");
String ExpireDate=request.getParameter("textfield9");
try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:pharm");
PreparedStatement stmt=con.prepareStatement("insert into card
values(?,?,?,?,?,?,?,?,?,?)");

stmt.setString(1, CustomerName);
stmt.setString(2, Address);
stmt.setString(3, City);
stmt.setString(4, state);
stmt.setString(5, zipcode);
stmt.setString(6, phoneno);
stmt.setString(7, Email);
stmt.setString(8, Cardtype);
stmt.setString(9, Creditcardnumber);
stmt.setString(10, ExpireDate);
int i=stmt.executeUpdate();
out.println("You are Successfully Registered");
con.close();
}
catch(Exception e)
{
out.print("Registeration Failed");
out.println("Error:" +e);
}
}

Help.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="palegreen">
<center><b>COUGH MEDICINES</b><p></p>
<b>Guaifenesin </b>
<p>Guaifenesin thins phlegm or mucus in people's lungs to help suppress or reduce
coughing.
It is found in both prescription and over-the-counter strengths.
Guaifenesin may cause abdominal pain, a rash, diarrhea, hives, nausea, headaches, dizziness
or vomiting.</p>
<b>Narcotics</b>
<p>Codeine is a prescription-only remedy for coughs.
It is an antitussive and acts on the brain's cough center, just as dextromethorphan does.
Codeine is a narcotic and may make your body dependent on it with prolonged use.</p>
<b><i>Carbetapentane</i></b>
<p>Carbetapentane is a non-narcotic cough suppressant.
Brand names include Rentamine 12, Tustan 12S, Tannihist 12RF, Ricotuss H and others.
Side effects may include confusion, seizures, constipation, insomnia, hallucinations, difficulty
breathing, dizziness and headaches.</p>
<b><i>Caramiphen</i></b>
<p>Caramiphen is a cough suppressant marketed as Tusso-Gest, Ordrine AT, Tuss Vernade and
Rescaps-D.
It is prescribed as capsules or tablets.
Caramiphen may produce such side effects as high blood pressure, nausea, insomnia, headaches,
a rash, chest pains, dizziness or drowsiness.</p>
</center>
</body>
</html>
Output:
Home page

Login Page:
Registration page

Help Page
Search for medicine
Shipping:

Result: Thus e commerce application for online pharmacy is created and executed.
Aim:
The aim of project is create a web service for project and consume by client .
Procedure:

i) Creating a java Web Service:

1. Open the NetBeans IDE.


2. Create a new project by choosing New Project from the File menu to open the New
Project Wizard dialog. In the dialog, choose Web from the category list on the left and
choose Web Application from the Project list on the right. Click the Next button to
continue.
3. Enter a name CalculatorWSApplication for the web project and click Next to continue.
4. Accept the defaults on the next dialog box and click Finish to create the project.
5. Right-click the CalculatorWSApplication node and choose New > Web Service.
6. Name the web service CalculatorWS, type org.me.calculator in Package, and click Finish.
The Projects window displays the structure of the new web service and the visual
designer is shown in the editor area.
7. Now design the web service
8. Click Add Operation in the visual designer. A dialog box appears where you can define
the new operation.
9. In the upper part of the Add Operation dialog box, type add in Name and type int in the
Return Type drop-down list. In the lower part of the Add Operation dialog box, click Add
and create a parameter of type int named i. Then click Add again and create a parameter
of type int called j.
10. Click OK at the bottom of the Add Operation dialog box.
11. Similarly create the other Arithmetic Operations such as Subtraction. Multiplication And
Division. The visual designer now displays the following:
12. Click Source and notice that the source code that has been generated in the previous steps
is as follows:
13. Click Source and notice that the source code that has been generated in the previous steps
is as follows:

Web Service CalculatorWS.java

package org.me.calculator;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "CalculatorWS")
public class CalculatorWS {
/**
* Web service operation
*/
@WebMethod(operationName = "add")
public int add(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
//TODO write your implementation code here:
int k = i + j;
return k;
}
/**
* Web service operation
*/
@WebMethod(operationName = "sub")
public int sub(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
//TODO write your implementation code here:
int k = i - j;
return k;
}
/**
* Web service operation
*/
@WebMethod(operationName = "mul")
public int mul(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
//TODO write your implementation code here:
int k = i * j;
return k;
}
/
Web service operation
*/
@WebMethod(operationName = "Div")
public int Div(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
//TODO write your implementation code here:
int k = i / j;
return k;
}}
14.Now deploy and test the web service
15.Right-click the project and choose Deploy. The IDE starts the application server, builds the
application, and deploys the application to the server.
16.The IDE opens the tester page browser, if you deployed a web application to GlassFish.
17. http://localhost:8080/CalculatorWSApplication/CalculatorWS?Tester

Calculator operation:
Click add button

Click sub button


Click div button

Click mul button


18.Right-click the project node, choose Properties, and click Run. Depending on the deployment
server that you want to use, do the following:
For GlassFish, type/ CalculatorWS_Service?Tester in the Relative URL field.
ii) Consuming the web service:
Client : JSP Page in Web Application

In this section, create a new web application and then consume the web service in the default JSP
page that the Web Application wizard creates.

19. Choose File > New Project (Ctrl-Shift-N). Select Web Application from the Web category.
Name the project CalculatorWSJSPClient. Click Finish.
20. Right-click the CalculatorWSJSPClient node and choose New > Web Service Client.
21. In Project, click Browse. Browse to the web service that you want to consume. When you
have selected the web service, click OK.
22. Leave the other settings at default (in 6.0.x, do not set a package name) and click Finish.
23. In the Web Service References node, expand the node that represents the web service. The
add, sub ,mul, div operations, which you will invoke from the client, is now exposed.
24. Drag the add operation to the client's index.jsp page, and drop it below the H1 tags. The code
for invoking the service's operation is now generated in the index.jsp page, as you can see
here:
Consume.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<center> <h1>Consuming the Calculator Web Service</h1></center>

<%-- start web service invocation --%><hr/>


<%
try {
org.me.calculator.CalculatorWS_Service service = new
org.me.calculator.CalculatorWS_Service();
org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();
// TODO initialize WS operation arguments here
int i = 10;int j = 5;
// TODO process result here
int result = port.add(i, j);
out.println("Result add = "+result);

org.me.calculator.CalculatorWS_Service service = new


org.me.calculator.CalculatorWS_Service();

} catch (Exception ex) {


// TODO handle custom exceptions here
} %>
web service invocation --%>
<% try {
org.me.calculator.CalculatorWS_Service service = new
org.me.calculator.CalculatorWS_Service();
org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();
// TODO initialize WS operation arguments here
int i = 10;
int j = 5;
// TODO process result here
int result = port.div(i, j);
out.println("Result div = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
} %>
<%-- end web service invocation --%><hr/>
<% try {
org.me.calculator.CalculatorWS_Serviceservice=neworg.me.calculator.CalculatorWS_Se
rvice();
org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();
// TODO initialize WS operation arguments here
int i = 10;
int j = 5;
// TODO process result here
int result = port.mul(i, j);
out.println("Result mul = "+result);
} catch (Exception ex) {
/ TODO handle custom exceptions here
} %> <%-- end web service invocation --%><hr/>
</body>
</html>
25.Right-click the project node and choose Run. The server starts, if it wasn't running already.
The application is built and deployed, and the browser opens, displaying the calculation result:
Result:
Thus web service for simple calculator project developed and consumed by client
application.

You might also like