0% found this document useful (0 votes)
115 views72 pages

IP Lab Coding329

The document discusses creating a web page using HTML and dividing it into frames. It includes the code for the main page and individual frames to display information about a college, with navigation links between the frames. Images are also mapped to different regions to link to additional pages for each area.

Uploaded by

3Dotzz RnD
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 (0 votes)
115 views72 pages

IP Lab Coding329

The document discusses creating a web page using HTML and dividing it into frames. It includes the code for the main page and individual frames to display information about a college, with navigation links between the frames. Images are also mapped to different regions to link to additional pages for each area.

Uploaded by

3Dotzz RnD
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

CS2358 INTERNET PROGRAMMING LAB Reg.

No:20609104329

1. CREATE A WEB PAGE AND DIVIDE IT BY FRAMES WITH


HYPERLINK USING HTML

PROGRAM:

[Link]
<html>
<head>
<title>WEB PAGE</title>
</head>
<frameset rows="18%,*,5%" bordercolor="RED">
<frame src="[Link]"/>
<frameset cols="20%,*">
<frame src="[Link]" name="f2"/>
<frame src="[Link]" name="f3"/>
</frameset>
<frame src="[Link]"/>
</frameset>
<body>
</body>
</html>

[Link]
<html>
<head>
<title>Frame1</title>
</head>
<body bgcolor="INDIYA">
<center>
<font color="black" size="5" face="Monotype Corsiva">
CS2358 INTERNET PROGRAMMING LAB [Link]

<b>MAAMALLAN INSTITUTE OF TECHNOLOGY</b><br />


Maamallan Nagar,Vada Mangalam, <br />
Sriperumpudhur.
</font>
</center>
<marquee>
<font color="red" face="Monotype Corsiva">
<i>You can see some information in this page by clicking relevant buttons</i>
</font>
</marquee>
</body>
</html>

[Link]
<html>
<body bgcolor=”indiga”>
<br><br>
<center>
<b><i>Click Here</i></b><br><br>
<a href="[Link]" target="f3"><h3><font color=black>Introduction</font></h3></a>
<a href="[Link]" target="f3"><h3><font color=black>ContactUs</font></h3></a>
<a href="[Link]" target="f3"><h3><font color=black>FeedBack</font></h3></a>
<a href="[Link]" target="f3"><h3><font color=black>Album</font></h3></a>
</center>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link]
<html>
<head>
<title>Album</title>
</head>
<body>
<p align="right">CopyRights@Maamallan Institute Of Technology</p>
</body>
</html>

[Link]
<html>
<head>
<title>Introduction</title>
</head>
<body bgcolor="facbdefgh">
<br> <br><br>
<font color="black" face="Courier New">Maamallan Institute of Technology was formed by
our belowed chairmen [Link] M.A,B.L,Phd., </font>
</body>
</html>

[Link]
<html>
<head>
<title>feedback</title>
</head>
<body>
<center>
CS2358 INTERNET PROGRAMMING LAB [Link]

<table bgcolor="aqua" width="100%" height="100%">


<tr>
<td width="25%">Name </td>
<td width="75%"> <input type="text" name="txtname" /></td>
</tr>
<tr>
<td>Phone </td>
<td><input type="text" name="txtphone" /></td>
</tr>
<tr>
<td>Address </td>
<td><input type="text" name="txtAddress" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="txtemail" /></td>
</tr>
<tr>
<td>City</td>
<td><input type="text" name="txtcity" /></td>
</tr>
<tr>
<td>Country</td>
<td><select name="cmbcountry">
<option>India</option>
<option>US</option>
<option>Sri Lanka</option>
<option>USA</option>
<option>Australia</option>
CS2358 INTERNET PROGRAMMING LAB [Link]

<option>Canada</option>
<option>Pakistan</option>
<option>Bangaladesh</option>
</select>
</td>
</tr>
<tr>
<td>Hobbies</td>
<td>
<input type="checkbox" name="chkplaying" />playing
<input type="checkbox" name="chkreading" />Reading
<input type="checkbox" name="chkpainting"/>Painting
</td>
</tr>
<tr>
<td>Feed back</td>
<td><textarea name="ta"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" name="btnSave" value="Save" />
</td>
</tr>
</table>
</center>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link]
<html>
<head>
<title>Album</title>
</head>
<body>
<font size="12">My Favorite Picture<font>
<img src="[Link]" width="200" height="150"/>
</body>
</html>

[Link]
<html>
<head>
<title>Biodata</title>
</head>
<body>
<center>
<table border="1">
<tr>
<td width="25%"> Name </td>
<td width="75%"> MAAMALLAN INSTITUTE OF TECHNOLOGY</td>
</tr>
<tr>
<td>Address </td>
<td>Maamallan Nagar,Vada Mangalam,<br />Sriperumpudhur. </td>
</tr>
<tr>
<td>Website</td>
CS2358 INTERNET PROGRAMMING LAB [Link]

<td>[Link]</td>
</tr>
<tr>
<td>Eemail</td>
<td>maamallancollege@[Link]</td>
</tr>
</table>
</center>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link] MAPPING

PROGRAM:

[Link]
<html>
<head>
<title> World Information </title>
</head>
<body>
<map name="world">
<img height=300 width=800 src = "..\..\images\[Link]" ismap usemap=#world>
<area name="asia" shape="rect" coords="520,20,730,185" href="[Link]">
<area name="measia" shape="circle" coords="480,125,30" href="[Link]">
<area name="samerica" shape = "circle" coords="235,200,55" href="[Link]">
<area name="africa" shape="circle" coords="420,180,55" href="[Link]">
<area name="namerica" shape = "rect" coords="55,15,325,180" href="[Link]">
<area name="europe" shape = "rect" coords="335,40,495,85" href="[Link]">
<area name="australia" shape="rect" coords="615,185,750,275" href="[Link]">
</map>
<h3> General information about our world <h3>
<small><i>
<ul>
<li> Most populated country : China Population 1,307,000,000</li>
<li>world's tallest mountain, Mt Everest in Nepal 29,025 ft. (8.850 m)</li>
<li>world's lowest point, found in the Dead Sea, Israel/Jordan, at 1,286 ft (392m)
below sea level</li>
<li>world's deepest lake Lake Baykal, Siberia, Russia, 5369 ft (1637 m)</li>
<li>worlds longest river nile river 4,160 miles (6,693 km) in length</li>
<li>worlds largest desert sahara desert approximately 3,500,000 sq. miles (9,065,000
sq. km)</li>
CS2358 INTERNET PROGRAMMING LAB [Link]

<li>World's longest coast line: coast line in Canada longest at 243792 km (151485
miles)</li>
<li>Worlds's largest city: Tokyo, Japan (35327000 )</li>
</ul>
</i></small>
</body>
</html>

[Link]
<html>
<head>
<title>AFRICA</title>
</head>
<body>
<h3 align=center>Africa includes 53 individual countries</h3>
<img align="left" src="..\..\images\[Link]" height=320 width=320></img><br>
<table border=0>
<tr>
<th align=left>Continent Size:</th>
<td align=left>30,065,000 sq km (11,608,000 sqm)</td>
</tr>
<tr>
<th align=left>Percent of Earth's Land:</th>
<td align=left>20.2%</td>
</tr>
<tr>
<th align=left>Total Population:</th>
<td>877,500,000</td>
</tr>
<tr>
CS2358 INTERNET PROGRAMMING LAB [Link]

<th align=left>Most populated countries:</th>


</tr>
<tr>
<td></td>
<td>
<table>
<tr>
<th><small>Country</small></th>
<th><small>Population</small></th>
</tr>
<tr>
<td><small><i>Nigeria</i></small></td>
<td align=right>
<small><i>125,750,356</i></small>
</td>
</tr>
<tr>
<td><small><i>Egypt</i></small></td>
<td align=right>
<small><i>76,117,421</i></small>
</td>
</tr>
<tr>
<td><small><i>Ethiopia</i></small></td>
<td align=right>
<small><i>71,336,571</i></small>
</td>
</tr>
<tr>
<td><small><i>Congo</i></small></td>
CS2358 INTERNET PROGRAMMING LAB [Link]

<td align=right>
<small><i>58,317,930</i></small>
</td>
</tr>
<tr>
<td><small><i>South Africa</i></small></td>
<td align=right>
<small><i>44,448,470</i></small>
</td>
</tr>
<tr>
<td><small><i>Sudan</i></small></td>
<td align=right>
<small><i>39,148,162</i></small>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

3. PROGRAM TO CREATE A WEBPAGE USING HTML WITH


STYLE SHEET(CSS)

1) INTERNAL CSS PROGRAM:

PROGRAM:
<html>
<head>
<title>INTERNAL CSS</title>
<style type="text/css">
body
{
COLOR:red;
FONT-FAMILY: 'Arial';
BACKGROUND: yellow;
}
p
{
MARGIN-LEFT:25 px;
COLOR:BLUE;
}
ul
{
MARGIN-LEFT:35px;
COLOR:'green';
FONT-FAMILY: 'VERDANA';
}
</style>
</head>
<body>
<p align=center>
CS2358 INTERNET PROGRAMMING LAB [Link]

<strong><u> PG COURSES</u></strong>
</p>
<ul>
<li>MCA</li>
<li>MBA</li>
</ul>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

2) EXTERNAL CSS PROGRAM:


PROGRAM:
<html>
<head>
<link REL="STYLESHEET" TYPE="TEXT/CSS" HREF="[Link]">
<title>External CSS Program</title>
</head>
<body>
<p align=center><strong><Font size=5>MIT</Font></strong></p>
<p align=left><strong><u>COURSE OFFERED</u></strong></p>
<font face="Arial">
<ul>
<li><a href="[Link]">PG COURSE</a></li>
<li><a href="[Link]">UG COURSE</a></li>
</ul>
</font>
</body>
</html>

[Link]
body
{
background:YELLOW;
FONT-FAMILY:'Elephant';
}
p
{
MARGIN-LEFT:25px;
COLOR:green;
}
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link]
<html>
<head>
<title>this is PG course</title>
</head>
<body>
<li>MCA</li>
<li>MBA</li>
</body>
</html>

[Link]:
<html>
<head>
<title>this is UG course</title>
</head>
<body>
<li>CSE</li>
<li>IT</li>
<li>ECE</li>
<li>MECH</li>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]
CS2358 INTERNET PROGRAMMING LAB [Link]

3) INLINE CSS PROGRAM:


PROGRAM:
<html>
<head>
<title>INLINE STYLE</title>
</head>
<body BGCOLOR=pink>
<p style="FONT-FAMILY:'Time New Roman';color:black;font-style:bold">
<u>UG COURSE</u>
</p>
<ul style="font-family:'Elephant';color:red;font-style:italic">
<li>CSE</li>
<li>IT</li>
<li>ECE</li>
<li>MECH</li>
</ul>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

4. FORM VALIDATION USING JAVASCRIPT

PROGRAM:
<html>
<head>
<title>Validating Form Controls</title>
<style type="text/css">
table
{
border:1px solid black;
width:70%;
height:50%;
}
</style>
<script type="text/javascript" language="javascript">
function DoValidation()
{
if([Link]=="")
{
alert("Please Enter the User Name");
[Link]();
return false;
}
if([Link]=="")
{
alert("Please Enter the Password");
[Link]();
return false;
}
else if([Link]=="")
CS2358 INTERNET PROGRAMMING LAB [Link]

{
alert("Please Enter the Confirm Password");
[Link]();
return false;
}
if([Link]<6 || [Link]<6)
{
alert("Password Should have atleast 6 characters");
return false;
}
if([Link] !=[Link])
{
alert("Confirm Pwd Should same as ur password");
[Link]();
return false;
}
if([Link] =="")
{
alert("Please Enter the Email.");
[Link]();
return false;
}
else if([Link] !="")
{
if([Link]('@')<=0)
{
alert("Your email format is incorrect");
[Link]();
return false;
CS2358 INTERNET PROGRAMMING LAB [Link]

}
else if([Link]('.')<=0)
{
alert("Your email format is incorrect");
[Link]();
return false;
}
}
if([Link]=="")
{
alert("Please Enter the Phone No");
[Link]();
return false;
}
else if([Link]!="")
{
if(isNaN([Link]))
{
alert("Please Enter the Phone No Correctly");
[Link]();
return false;
}
else if([Link]!=10)
{
alert("Please Enter the Phone No Correctly 10 digits");
[Link]();
return false;
}
}
CS2358 INTERNET PROGRAMMING LAB [Link]

if([Link]=="")
{
alert("Please Enter the Address");
[Link]();
return false;
}
if([Link]==0)
{
alert("Please Select the Nationality");
[Link]();
return false;
}
if([Link]=="")
{
alert("Please Browse and Upload your Photo");
[Link]();
return false;
}
if([Link]==false)
{
alert("Please Accept the terms and condition");
[Link]();
return false;
}
else
{
alert("Your REcords saved Corrctly");
return false;
}
CS2358 INTERNET PROGRAMMING LAB [Link]

}
function sel()
{
alert([Link][[Link]].value);
}
</script>
</head>
<body>
<form name="frm">
<table align="center">
<tr>
<td>User Name :</td>
<td><input type="text" name="txtName" /></td>
</tr>
<tr>
<td>Password :</td>
<td><input type="password" name="txtPwd" /></td>
</tr>
<tr>
<td>Confirm Password :</td>
<td><input type="password" name="txtConPwd" /></td>
</tr>
<tr>
<td>E mail:</td>
<td><input type="text" name="txtEmail" /></td>
</tr>
<tr>
<td>Phone :</td>
<td><input type="text" name="txtPh" /></td>
CS2358 INTERNET PROGRAMMING LAB [Link]

</tr>
<tr>
<td>Address :</td>
<td><textarea name="txtAddress" cols="15" rows="4"></textarea></td>
</tr>
<tr>
<td>Nationality :</td>
<td><select name="cmbNationality" onchange="sel();">
<option value="Select">Select</option>
<option value="India">India</option>
<option value="US">US</option>
<option value="SL">Sri Lanka</option>
<option value="China">China</option>
<option value="Eng">England</option>
</select>
</td>
</tr>
<tr>
<td>Gender :</td>
<td>
<input type="radio" checked="checked" value="Male" name="rdGender" />Male
<input type="radio" value="FeMale" name="rdGender" />FeMale
</td>
</tr>
<tr>
<td>Photo :</td>
<td><input type="file" name="filePhoto" /></td>
</tr>
<tr>
CS2358 INTERNET PROGRAMMING LAB [Link]

<td colspan="2"><input type="checkbox" name="cbxAccept" />


Accept all the conditions
</td>
</tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Save" name="btnSubmit" onclick="DoValidation();" />
<input type="reset" value="Reset" name="btnReset" />
</td>
</tr>
</table>
</form>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

5.a) TEXT FIELD

PROGRAM:
/* <applet code=TextApplet height=300 width=400> </applet>*/
import [Link].*;
import [Link].*;
import [Link].*;

public class TextApplet extends Applet implements ActionListener


{
String msg=" ";
TextField ip1=new TextField(5);
TextField ip2=new TextField(6);
Button b1=new Button("Add");
public void init()
{
[Link](ip1);
[Link](ip2);
[Link](b1);
[Link](this);
}
public void actionPerformed(ActionEvent e)
{
int sum=0;
String t1=[Link]();
String t2=[Link]();
int a=[Link](t1);
int b=[Link](t2);
sum=a+b;
msg="Sum is"+sum;
CS2358 INTERNET PROGRAMMING LAB [Link]

repaint();
}
public void paint(Graphics g)
{
[Link](msg,6,100);
}
}
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

5. b) PROGRAM TO CREATE COLOR PALETTE

PROGRAM:
/* <applet code=palette height=600 width=600>
</applet> */
import [Link].*;
import [Link].*;
import [Link].*;
public class palette extends Applet implements ActionListener,ItemListener
{
Button[] colors;
Checkbox foreground,background;
TextArea workarea;
CheckboxGroup cbg;
Panel buttonpanel,checkpanel,palettepanel;
String colour;
public void init()
{
buttonpanel=new Panel();
[Link](new GridLayout(3,3));
colors=new Button[9];
colors[0]=new Button("RED");
colors[1]=new Button("GREEN");
colors[2]=new Button("BLUE");
colors[3]=new Button("CYAN");
colors[4]=new Button("ORANGE");
colors[5]=new Button("WHITE");
colors[6]=new Button("BLACK");
colors[7]=new Button("YELLOW");
colors[8]=new Button("PINK");
CS2358 INTERNET PROGRAMMING LAB [Link]

for(int i=0;i<9;i++)
{
colors[i].addActionListener(this);
[Link](colors[i]);
}
checkpanel=new Panel();
[Link](new FlowLayout());
cbg=new CheckboxGroup();
foreground=new Checkbox("ForeGround",cbg,true);
background=new Checkbox("BackGround",cbg,false);
[Link](this);
[Link](this);
[Link](foreground);
[Link](background);
workarea=new TextArea(8,40);
[Link](new Font("Garamond",[Link],20));
palettepanel=new Panel();
[Link](new BorderLayout());
[Link](workarea,[Link]);
[Link](checkpanel,[Link]);
[Link](buttonpanel,[Link]);
add(palettepanel);
}
public void itemStateChanged(ItemEvent ie)
{
}
public void actionPerformed(ActionEvent ae)
{
colour=[Link]();
CS2358 INTERNET PROGRAMMING LAB [Link]

if([Link]()==true)
[Link](getColour());
if([Link]()==true)
[Link](getColour());
}
public Color getColour()
{
Color mycolor=null;
if([Link]("RED"))
mycolor=[Link];
if([Link]("GREEN"))
mycolor=[Link];
if([Link]("BLUE"))
mycolor=[Link];
if([Link]("CYAN"))
mycolor=[Link];
if([Link]("ORANGE"))
mycolor=[Link];
if([Link]("WHITE"))
mycolor=[Link];
if([Link]("BLACK"))
mycolor=[Link];
if([Link]("YELLOW"))
mycolor=[Link];
if([Link]("PINK"))
mycolor=[Link];
return mycolor;
}
}
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link] TO INVOKE SERVLETS FROM HTML FORMS USING


SERVLETS

PROGRAM:
Html

<html>
<head>
<title> Invoking Servlet From Html </title>
</head>
<body>
<form action = "[Link] method="GET">
<p>Press the button to invoke servlet<p>
<input type="submit" value="Go for it!">
</form>
</body>
</html>

Servlet
[Link]
import [Link].*;
import [Link].*;
import [Link].*;
public class SampleServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException
{
PrintWriter out;
try
{
out= [Link]();
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link]("<html>
<head>
<title> Response From Servlet<title>
</head>
<body>
<h3>This Text Is Generated By Invoked Servlet </h3>
</body>
</html>");
}
catch(IOException ie)
{
[Link]();
}
}
}
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

7 a) ONLINE EXAMINATION
PROGRAM:
[Link]
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<%@page language ="java" import="[Link].*"%>
<%@page import="[Link].*"%>
<%@ page import="[Link].*"%>
<%
String SeatNum,Name;
String ans1,ans2,ans3,ans4,ans5;
int a1,a2,a3,a4,a5;
a1=a2=a3=a4=a5=0;
Connection connect=null;
Statement stmt=null;
ResultSet rs=null;
[Link]("[Link]");
String url="jdbc:odbc:MyDsn";
connect=[Link](url);
if([Link]("action")!=null)
{
SeatNum=[Link]("Seat_no");
Name=[Link]("Name");
ans1=[Link]("group1");
if([Link]("True"))
a1=a2;
else
a1=0;
CS2358 INTERNET PROGRAMMING LAB [Link]

ans2=[Link]("group2");
if([Link]("True"))
a2=0;
else
a2=2;
ans3=[Link]("group3");
if([Link]("True"))
a3=0;
else
a3=2;
ans4=[Link]("group4");
if([Link]("True"))
a4=2;
else
a4=0;
ans5=[Link]("group5");
if([Link]("True"))
a5=0;
else
a5=2;
int Total=a1+a2+a3+a4+a5;
stmt=[Link]();
String query= "INSERT INTO Exam(SeatNum,Name,Total) VALUES
("+SeatNum+",'"+Name+"',"+Total+")";
int result=[Link](query);
[Link]();
stmt=[Link]();
query="SELECT * FROM Exam WHERE Name='"+Name+"'";
rs=[Link](query);
%>
CS2358 INTERNET PROGRAMMING LAB [Link]

<html>
<head>
<title>Student Mark List</title>
</head>
<body bgcolor=khaki>
<center>
<h2>Student MarkSheet</h2>
<h3>Name of the College:ABC College of Engineering</h3>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td><b>Seat_No</b></td>
<td><b>Name</b></td>
<td><b>Marks</b></td>
</tr>
<%
while([Link]())
{
%>
<tr>
<td><%=[Link](2)%></td>
<td><%=[Link](3)%></td>
<td><%=[Link](4)%></td>
</tr>
<%
}
[Link]();
[Link]();
[Link]();
%>
CS2358 INTERNET PROGRAMMING LAB [Link]

</table>
</center>
<br/><br/><br/>
<table>
<tr>
<td><b>Date:<%= new [Link]().toString()%></b></td>
</tr>
<tr>
<td><b>Signature:X.Y.Z</b></td>
</tr>
</table>
<a href="[Link] here to go back</a>
</body>
</html>
<%
}
Else
{
%>
<html>
<head>
<title>Online Examination</title>
<script language="javascript" type="text/javascript">
function validation(Form_obj)
{
if(Form_obj.Seat_no.[Link]==0)
{
alert("Please fill up the seat number");
Form_obj.Seat_no.focus();
CS2358 INTERNET PROGRAMMING LAB [Link]

return false;
}
if(Form_obj.[Link]==0)
{
alert("Please fill up the name");
Form_obj.[Link]();
return false;
}
return true;
}
</script>
</head>
<body bgcolor=lightgreen>
<center><h1>Online Examination</h1></center>
<form action="[Link]" method="post" name="entry" onSubmit="return
validation(this);">
<input type="hidden" value="list" name="action">
<table>
<tr>
<td><h3>Seat Number</h3></td>
<td><input type="tex" name="Seat_no"></td>
</tr>
<tr>
<td><h3> Name</h3></td>
<td><input type="text" name="Name" size=50></td>
</tr>
<hr/>
<tr>
<th>Total Marks :10(Each question carries equal marks)</th>
<td><b>Time:15 min</b></td>
CS2358 INTERNET PROGRAMMING LAB [Link]

</tr>
</table>
<hr/>
<b>[Link] is an open source web server</b><br/>
<input type="radio" name="group1" value="True">True
<input type="radio" name="group1" value="False">False<br>
<b>[Link] modern PC there is no cache memory</b><br/>
<input type="radio" name="group2" value="True">True
<input type="radio" name="group2" value="False">False<br>
<b>[Link]-Berner Lee is the originator of java</b><br/>
<input type="radio" name="group3" value="True">True
<input type="radio" name="group3" value="False">False<br>
<b>[Link] is not a video file extension</b><br/>
<input type="radio" name="group4" value="True">True
<input type="radio" name="group4" value="False">False<br>
<b>[Link] is a stateful protocol</b><br/>
<input type="radio" name="group5" value="True">True
<input type="radio" name="group5" value="False">False<br>
<center>
<input type="submit" value="Submit">
<input type="reset" value="Clear">
</center>
</form>
</body>
</html>
<%
}
%>
CS2358 INTERNET PROGRAMMING LAB [Link]

TABLE DESIGN:
Exam(Table in MS Access)
Table Name:Exam
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT
CS2358 INTERNET PROGRAMMING LAB [Link]

7.b) STUDENT MARKLIST

PROGRAM
[Link]

import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
public class register extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse resp)
{
try
{
[Link]("text/html");
PrintWriter out=[Link]();
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:student");
Statement stmt=[Link]();
String regno=[Link]("txtreg");
String name=[Link]("txtname");
String age=[Link]("txtage");
int a=[Link](age);
String mark1=[Link]("txtMark1");
String mark2=[Link]("txtMark2");
String mark3=[Link]("txtMark3");
int m1=[Link](mark1);
int m2=[Link](mark2);
int m3=[Link](mark3);
CS2358 INTERNET PROGRAMMING LAB [Link]

int result=[Link]("insert into student (RegNo, Name,


Age, Mark1, Mark2, Mark3) values('"+ regno +"','"+ name +"',"+ a
+","+ m1 +","+ m2+","+m3+")");
ResultSet rs=[Link]("select * from student");
[Link]("<html> <head> <title>DBCON</title> </head> <body>
<table border=1> <tr bgcolor=cyan> <th>RegNo</th>
<th>Name</th> <th>Age</th> <th>Mark1</th> <th>Mark2</th>
<th>Mark3</th> </tr>");
while([Link]())
{
[Link]("<tr><td>"+[Link](2)+"</td>");
[Link]("<td>"+[Link](3)+"</td>");
[Link]("<td>"+[Link](4)+"</td>");
[Link]("<td>"+[Link](5)+"</td>");
[Link]("<td>"+[Link](6)+"</td>");
[Link]("<td>"+[Link](7)+"</td>");
[Link]("</tr>");
}
[Link]("</table></body></html>");
[Link]();
[Link]();
}
catch(Exception e)
{
[Link]("Exception Occured");
}
}
}
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link]
<html>
<head>
<title>Student Mark List</title>
</head>
<body>
<form method="GET" action="http:\\localhost:8080\examples\servlet\register">
<h1 align="center">Student Mark List</h1>
<table align="center">
<tr>
<td>Enter your Reg no:</td>
<td><input type="text" name="txtreg"/></td>
</tr>
<tr>
<td>Enter your Name:</td>
<td><input type="text" name="txtname"/></td>
</tr>
<tr>
<td>Enter your Age:</td>
<td><input type="text" name="txtage"/></td>
</tr>
<tr>
<td>Enter your Mark1:</td>
<td><input type="text" name="txtMark1"/></td>
</tr>
<tr>
<td>Enter your Mark2:</td>
<td><input type="text" name="txtMark2"/></td>
</tr>
CS2358 INTERNET PROGRAMMING LAB [Link]

<tr>
<td>Enter your Mark3:</td>
<td><input type="text" name="txtMark3"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input value="submit"/></td>
</tr>
</table>
</form>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

TABLE DESIGN:
Student(Table in MS Access)
Table Name:Student
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link] USING XML-SCHEMA-XSLT/XSL


[Link]

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


<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="[Link]
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="red">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
CS2358 INTERNET PROGRAMMING LAB [Link]

[Link]
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="[Link]"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
<cd>
CS2358 INTERNET PROGRAMMING LAB [Link]

<title>Still got the blues</title>


<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
<cd>
<title>Eros</title>
<artist>Eros Ramazzotti</artist>
<country>EU</country>
<company>BMG</company>
<price>9.90</price>
<year>1997</year>
</cd>
<cd>
<title>One night only</title>
<artist>Bee Gees</artist>
<country>UK</country>
<company>Polydor</company>
<price>10.90</price>
<year>1998</year>
</cd>
<cd>
<title>Sylvias Mother</title>
<artist>[Link]</artist>
<country>UK</country>
<company>CBS</company>
<price>8.10</price>
CS2358 INTERNET PROGRAMMING LAB [Link]

<year>1973</year>
</cd>
<cd>
<title>Maggie May</title>
<artist>Rod Stewart</artist>
<country>UK</country>
<company>Pickwick</company>
<price>8.50</price>
<year>1990</year>
</cd>
<cd>
<title>Romanza</title>
<artist>Andrea Bocelli</artist>
<country>EU</country>
<company>Polydor</company>
<price>10.80</price>
<year>1996</year>
</cd>
<cd>
<title>When a man loves a woman</title>
<artist>Percy Sledge</artist>
<country>USA</country>
<company>Atlantic</company>
<price>8.70</price>
<year>1987</year>
</cd>
<cd>
<title>Black angel</title>
<artist>Savage Rose</artist>
CS2358 INTERNET PROGRAMMING LAB [Link]

<country>EU</country>
<company>Mega</company>
<price>10.90</price>
<year>1995</year>
</cd>
<cd>
<title>1999 Grammy Nominees</title>
<artist>Many</artist>
<country>USA</country>
<company>Grammy</company>
<price>10.20</price>
<year>1999</year>
</cd>
<cd>
<title>For the good times</title>
<artist>Kenny Rogers</artist>
<country>UK</country>
<company>Mucik Master</company>
<price>8.70</price>
<year>1995</year>
</cd>
</catalog>
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

9. PROGRAM USING AJAX


[Link]

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


<html>
<head>
<script type="text/javascript">
function LoadAjax()
{
var xmlhttp;
if([Link])
xmlhttp=new XMLHttpRequest();
else
xmlhttp=new ActiveXObject("[Link]");
[Link]=function()
{
if([Link]==4 && [Link]==200)
{
[Link]("mydiv").innerHTML =
[Link];
}
}
[Link]("GET",
"[Link] ",true);
[Link]();
}
</script>
<title>AJAX PROGRAM</title>
</head>
<body>
<div id="mydiv"></div>
CS2358 INTERNET PROGRAMMING LAB [Link]

<input type="button" value="click" onclick="LoadAjax();"/>


</body>
</html>

SampleServlet .java

import [Link].*;
import [Link].*;
import [Link].*;
public class SampleServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException
{
PrintWriter out;
try
{
out= [Link]();
[Link]("<html> <head> <title> Response From Servlet </title>
</head> <body> <p> <h3> This Text Is Generated By Invoked Servlet
</h3> </body> </html>");
}
catch(IOException ie)
{
[Link]();
}
}
}
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT:
CS2358 INTERNET PROGRAMMING LAB [Link]

10. WEB SERVICE

AIR LINE RESERVATION SYSTEM

STEPS:
1. OpenNetBeansIDECreate a New Project

2. FileNewProjectJava WebWeb ApplicationGive Your Project Name

Now One Solution Explorer Will Open in left Side of the Net Beans Tool

3. Right Click(On Your Project)NewWebService

4. Give Your Web service Name as MyWebService

5. Go to Design View Of Your MyWebService

6. Click Add OperationGive Your Operation Name As GetAirLineAdd Parameters and


Mention its Data Types

7. Click the Source of Your Web Service


CS2358 INTERNET PROGRAMMING LAB [Link]

Here we Are Adding Two Parameters

1. [Link]

2. [Link]
CS2358 INTERNET PROGRAMMING LAB [Link]

PROGRAM:
MyWebService

package myp;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
/**
*
* @author JuanAashish
*/
@WebService()
public class MyWebService
{
/**
* Web service operation
*/
@WebMethod(operationName = "Add")
public Integer Add(@WebParam(name = "a")
int a, @WebParam(name = "b")
int b)
{
//TODO write your implementation code here:
return a+b;
}
/**
CS2358 INTERNET PROGRAMMING LAB [Link]

* Web service operation


*/
@WebMethod(operationName = "GetAirLine")
public String GetAirLine(@WebParam(name = "From")
String From, @WebParam(name = "To")
String To)
{
String time="No Service";
try
{
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:MyDsn");
Statement stmt=[Link]();
ResultSet rs=[Link]("select Time from Airline where
From='"+From+"' AND To='"+To+"'");
while([Link]())
{
time=[Link](1);
}
[Link]();
[Link]();
}
catch(Exception e)
{}
return time;
}

/**
* Web service operation
*/
CS2358 INTERNET PROGRAMMING LAB [Link]

@WebMethod(operationName = "operation")
public String operation()
{
//TODO write your implementation code here:
return null;
}
}

CREATE A NEW JSP FOR CONNECTING WEB SERVICE:


[Link]
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String from=[Link]("txta");
String to=[Link]("txtb");
[Link] objWS=new [Link]();
%>
<h1>Time is:<%=[Link](from,to) %></h1>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

CREATE ONE HTML FOR ACCESSING FRONT PAGE


[Link]
<html>
<head>
<title>Air Lines</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form method="GET" action=" [Link]
From</br>
<input type="text" name="txta"/>
To</br>
<input type="text" name="txtb"/>
<input type="submit" value="submit"/>
</form>
</body>
</html>
CS2358 INTERNET PROGRAMMING LAB [Link]

TABLE DESIGN:
Table: Airline
CS2358 INTERNET PROGRAMMING LAB [Link]

OUTPUT

You might also like