Professional Documents
Culture Documents
AIM:
To create a webpage with the following using HTML
/
k
t
ALGORITHM:
.
e
b
u
t
e
s
c
/
/
:
p
PROGRAM:
t
t
h
SOLARSYSTEM.HTML
<HTML>
<HEAD>
<TITLE>solar system</TITLE>
</HEAD>
<BODY>
<img src="p1.jpg" width="600" height="500" usemap="#metroid" ismap="ismap" >
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<area href ="Mercury.html" shape = "rect" coords = "100,400,150,450" title = "Mercury planet" />
<area href ="venus.html" shape = "poly" coords = "150, 415, 175,348,265,360,190,420,190,440" title
="venus planet"/>
<area href ='earth.html' shape='circle' coords='175,495,180' title='Earth planet'/>
<area href ='mars.html' shape='circle' coords='175,495,230' title='Mars planet'/>
</map>
</BODY>
/
k
t
</HTML>
.
e
b
MERCURY.HTML
u
t
e
s
c
/
<HTML>
<HEAD>
/
:
p
<TITLE>About Mercury</TITLE>
</HEAD>
<BODY>
t
t
h
</p>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
VENUS.HTML
<HTML>
<HEAD>
/
k
t
<TITLE>About Mercury</TITLE>
.
e
b
</HEAD>
u
t
e
<BODY>
<CENTER> <H1>Venus Planet</H1> </CENTER>
s
c
/
<p>
/
:
p
Venus is the second planet from the Sun and the sixth largest. Venus' orbit is the most nearly circular of
that of any planet, with an eccentricity of less than 1%.
t
t
h
4.869e24 kg
Venus has been known since prehistoric times. It is the brightest object in the sky except for the Sun and
the Moon.
</p>
<a href='solarsystem.html'>solar planet</a>
</BODY>
</HTML>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
EARTH.HTML
<HTML>
<HEAD>
<TITLE>About Mercury</TITLE>
</HEAD>
<BODY>
<CENTER> <H1>Earth Planet</H1> </CENTER>
/
k
t
<p>
.
e
b
Earth is the third planet from the Sun and the fifth largest:
u
t
e
s
c
/
5.972e24 kg
/
:
p
t
t
h
Earth is the only planet whose English name does not derive from Greek/Roman mythology. The name
derives from Old English and Germanic. There are, of course, hundreds of other names for the planet in
other languages. In Roman Mythology, the goddess of the Earth was Tellus - the fertile soil
</p>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
MARS.HTML
<HTML>
<HEAD>
<TITLE>About Mercury</TITLE>
</HEAD>
<BODY>
<CENTER> <H1>Mars Planet</H1> </CENTER>
/
k
t
<p>
.
e
b
Mars is the fourth planet from the Sun and the seventh largest:
u
t
e
s
c
/
mass: 6.4219e23 kg
/
:
p
The first spacecraft to visit Mars was Mariner 4 in 1965. Several others followed including Mars
2, the first spacecraft to land on Mars and the two Viking landers in 1976. Ending a long 20 year hiatus,
Mars Pathfinder landed successfully on Mars on 1997 July 4. In 2004 the Mars Expedition Rovers "Spirit"
and "Opportunity" landed on Mars sending back geologic data and many pictures; they are still
operating after more than three years on M
t
t
h
</p>
OUTPUT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To create a webpage to implement inline style sheet.
ALGORITHM:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
PROGRAM:
INLINE.HTML
<html>
t
t
h
<head>
<title>inline sheet</title>
</head>
<body>
<p style="font-family:Showcard Gothic">Welcome user..</p>
<p style="font-size:40pt;font-family:Microsoft sans serif">Gmail</p>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
<p style="font-size:15pt;font-family=fixedsys">if you are a new user
/
/
<a href="logon.html">logon</a>here</p>
:
p
t
</body>
t
h
</html>
LOGON.HTML
<html>
<head>
<title>hai</title>
</head>
<body>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
</body>
u
t
e
</html>
PASS.HTML
s
c
/
<html>
/
:
p
<head> <title>hai</title>
t
t
h
</head> <body>
<h1>welcome to gmail</h1>
</body>
</html>
OUTPUT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To create a webpage with the following using html
ALGORITHM:
/
k
t
.
e
b
Create html file with the style tag, inside head tag.
Set the style such as font-family, font-size, color, left etc, for the heading
h1,h2,h6 and respectively.
Close the head tag.
Specify the heading and information required inside the body tag.
Close the opened tag.
u
t
e
s
c
/
/
:
p
PROGRAM:
<html>
<head>
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
}
h2
{
font-family:arial;
color:red;
left:20px;
}
/
k
t
h3
.
e
b
u
t
e
font-family:arial;
s
c
/
color:blue;
}
/
:
p
t
t
h
{
font-size:14pt;
font-family:verdana;
}
</style>
</head>
<body>
<h1> <center>EMBEDDED STYLE SHEET </h1>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
</html>
.
e
b
OUTPUT:
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To create a webpage with the following using html
ALGORITHM:
PROGRAM:
<html>
<head>
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
h1
.
e
b
u
t
e
font-family:arial;
s
c
/
color:red;
}
h2
{
/
:
p
t
t
h
font-family:verdana;
color:green;
}
OUTPUT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To develop a program for validating web form control using DHTML.
ALGORITHM:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
PROGRAM:
CODING:
<html>
<head>
<title>The Student Registration Form</title>
<script type=text/javascript>
function validate()
{
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
var i;
var name_str=document.my_form.name;
var phoneID=document.my_form.ph_txt;
var ph_str=document.my_form.ph_txt.value;
var str=document.my_form.Email_txt.value;
if((name_str.value==null)||(name_str.value==""))
{
alert("Enter Some Name")
/
k
t
return false
.
e
b
u
t
e
if(document.my_form.Age_txt.value=="")
{
s
c
/
/
:
p
return false
}
t
t
h
if((document.my_form.Age_txt.value<"5")&&(document.my_form.Age_txt.value>"21"))
{
alert("Invalid Age")
return false
}
if(ph_str.length<1||ph_str.length>11)
{
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
phoneID.focus()
return false
s
c
/
/
:
p
}
var index_at=str.indexOf("@")
var len=str.length
t
t
h
var index_dot=str.index(".")
var emailID=document.my_form.Email_txt
if((emailID.value==null)||(emailID.value==""))
{
alert("Please Enter Your Email_ID")
emailID.focus()
return false
}
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
if(str.indexOf("@")==-1)
{
alert("Invalid E_mail ID")
return false
}
if(str.indexOf(".")==-1||str.indexOf(".")==0||str.indexOf(".")==index_at)
{
alert("Invalid E_mail ID")
/
k
t
return false
.
e
b
if(str.indexOf("@",(index_at+1))!=-1)
s
c
/
/
:
p
u
t
e
t
t
h
if(str.indexOf(" ")!=-1)
{
alert("Invalid E_mail ID")
return false
}
if(!document.my_form.group1[0].checked&&!document.my_form.group1[0].checked)
{
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
return true
.
e
b
u
t
e
</script>
</head>
s
c
/
<body bgcolor=aqua>
/
:
p
<center><h2>APPLICATION FORM</h2></center>
<form name=my_form onsubmit=validate()>
<strong>
t
t
h
Name:        </strong>
<input type=text name=name><br/><br/>
<strong>
Age:           </strong>
<input type=text name=Age_txt><br/><br/>
<strong>Phone no:  </strong>
<input type=text name=ph_txt><br/><br/>
<strong>Email:        </strong>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<strong>Sex:       </strong>
<input type="radio"name="group1"value="Male">Male     
<input type="radio"name="group1"value="Female">Female<br/><br/><br/>
<strong>Hoby:</strong>
  
/
k
t
.
e
b
<input type="checkbox"name="option1"value="singing">Singing<br/>
u
t
e
             
<input type="checkbox"name="option1"value="reading">Reading<br/>
s
c
/
             
/
:
p
t
t
h
<strong>country:</strong>
<select name="My_menu">
<option value="India">India</option>
<option value="China">china</option>
<option value=SriLanka>srilanka</option>
<option value=Italy>italy</option>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
</select>
<center><br>
<input type=submit value=submit></br>
</center>
</body>
</html>
OUTPUT:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a java program to create applet with the following features create a color with
matrix of buttons
a. Set the background and foreground of the written text area by selecting a color from
color palette.
b. Order to select foreground or background use check control or radio button.
c. To set background images.
/
k
t
ALGORITHM:
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
PROGRAM:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*<applet code="exp" width=400 height=400>
</applet>*/
public class exp extends Applet implements ItemListener
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
{
int currcolor=5;
int flag=1;
String text="Click any of the buttons";
Button buttons[]=new Button[5];
String colours[]={"Red","Blue","Green","Yellow","Magenta"};
Image img;
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
for(int i=0;i<5;i++)
{
t
t
h
buttons[0].setBackground(Color.red);
buttons[1].setBackground(Color.blue);
buttons[2].setBackground(Color.green);
buttons[3].setBackground(Color.yellow);
buttons[4].setBackground(Color.magenta);
add(box1);
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
add(box2);
add(box3);
box1.addItemListener(this);
box2.addItemListener(this);
box3.addItemListener(this);
}
public void itemStateChanged(ItemEvent ev)
/
k
t
{
if(box1.getState()==true)
.
e
b
flag=1;
u
t
e
else if(box2.getState()==true)
{
s
c
/
/
:
p
flag=2;
}
t
t
h
else if(box3.getState()==true)
{
img=getImage(getDocumentBase(),"Water lilies.jpg");
flag=3;
}
repaint();
}
public void paint(Graphics g)
{
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
if(flag==2)
{
g.drawString(text,30,100);
switch(currcolor)
{
case 0:
g.setColor(Color.red);
/
k
t
break;
case 1:
.
e
b
g.setColor(Color.blue);
u
t
e
break;
case 2:
s
c
/
g.setColor(Color.green);
/
:
p
break;
case 3:
t
t
h
g.setColor(Color.yellow);
break;
case 4:
g.setColor(Color.magenta);
break;
case 5:
g.setColor(Color.black);
break;
}
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
g.drawString(text,30,100);
}
else if(flag==1)
{
g.drawString(text,30,100);
switch(currcolor)
{
/
k
t
case 0:
setBackground(Color.red);
.
e
b
break;
u
t
e
case 1:
setBackground(Color.blue);
s
c
/
break;
/
:
p
case 2:
t
t
h
setBackground(Color.green);
break;
case 3:
setBackground(Color.yellow);
break;
case 4:
setBackground(Color.magenta);
break;
case 5:
setBackground(Color.white);
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
break;
}
}
else if(flag==3)
{
g.drawImage(img,20,90,this);
}
/
k
t
}
public boolean action(Event e,Object o)
.
e
b
u
t
e
for(int i=0;i<5;i++)
{
s
c
/
if(e.target==buttons[i])
/
:
p
{
currcolor=i;
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
OUTPUT:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a html program for invoking servlet using html.
ALGORITHM:
/
k
t
Define the body tag inside the body tag create form and table simultaneously.
.
e
b
The table consists of following information Roll no, Student name, Address, Phone no
and total marks.
u
t
e
In the servlet program, import the summary package and create a own servlet class
extends with generic servlet.
s
c
/
/
:
p
t
t
PROGRAM:h
Java coding:
import java.io.*;
import java.util.*;
import javax.servlet.*;
public class myservletdemo extends GenericServlet
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
{
public void service(ServletRequest req,ServletResponse res)
throws ServletException,IOException
{
PrintWriter out=res.getWriter();
Enumeration en=req.getParameterNames();
while(en.hasMoreElements())
/
k
t
{
String name_received=(String)en.nextElement();
.
e
b
u
t
e
out.print(name_received+"=");
s
c
/
String value_received=req.getParameter(name_received);
out.println(value_received);
out.println(" ");
}
/
:
p
t
t
h
out.close();
}
}
HTML coding
<html>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<head>
<title>Student Information Form</title>
</head>
<body>
<form name="form1"
action="http://localhost:8080/examples/servlet/myservletdemo">
<h1>STUDENT INFORMATION FORM</H1>
/
k
t
.
e
b
<table>
<tr>
<td>Roll Number</td>
u
t
e
s
c
<td><input type="text" name="Roll
Number" size="25" value=" "></td>
/
/
</tr>
:
p
t
<tr>
t
h
<td>Student Name</td>
<td><input type="text" name="Student Name" size="25" value=" "></td>
</tr>
<tr>
<td>Student Address</td>
<td><input type="text" name="Student Address" size="50" value=" "></td>
</tr>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<tr>
<td>Phone</td>
<td><input type="text" name="Phone" size="10" value=" "></td>
</tr>
<tr>
<td>Total Marks</td>
<td><input type="text" name="Total Marks" size="25" value=" "></td>
/
k
t
</tr>
</table>
u
t
e
s
c
/
</form>
</center>
</body>
</html>
.
e
b
/
:
p
t
t
h
OUTPUT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
ALGORITHM:
/
k
t
Three checkbox fix in the webpage and it perform the sum of the operation in the
webpage.
.
e
b
Create the I no of buttons and each and every button has to be assigned the different
color.
u
t
e
Void item state changed() function is used and it get the state operation of the webpage.
s
c
/
Void paint() function and used to set the color and it also assign the background color.
Execute the program.
/
:
p
PROGRAM:
JAVA CODING:
t
t
h
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class exp5 extends Applet implements ItemListener
{
int currcolor=5;
int flag=1;
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
for(int i=0;i<5;i++)
{
s
c
/
/
:
p
add(buttons[i]);
}
t
t
h
buttons[0].setBackground(Color.red);
buttons[1].setBackground(Color.blue);
buttons[2].setBackground(Color.green);
buttons[3].setBackground(Color.yellow);
buttons[4].setBackground(Color.magenta);
add(box1);
add(box2);
add(box3);
box1.addItemListener(this);
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
box2.addItemListener(this);
box3.addItemListener(this);
}
public void itemStateChanged(ItemEvent ev)
{
if(box1.getState()==true)
flag=1;
else if(box2.getState()==true)
/
k
t
.
e
b
u
t
e
flag=2;
}
s
c
/
else if(box3.getState()==true)
/
:
p
t
t
h
repaint();
}
public void paint(Graphics g)
{
if(flag==2)
{
g.drawString(text,30,100);
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
switch(currcolor)
{
case 0:
g.setColor(Color.red);
break;
case 1:
g.setColor(Color.blue);
break;
/
k
t
case 2:
.
e
b
g.setColor(Color.green);
u
t
e
break;
case 3:
s
c
/
g.setColor(Color.yellow);
/
:
p
break;
case 4:
t
t
h
g.setColor(Color.magenta);
break;
case 5:
g.setColor(Color.black);
break;
}
g.drawString(text,30,100);
}
else if(flag==1)
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
{
g.drawString(text,30,100);
switch(currcolor)
{
case 0:
setBackground(Color.red);
break;
case 1:
/
k
t
setBackground(Color.blue);
.
e
b
break;
u
t
e
case 2:
setBackground(Color.green);
s
c
/
break;
/
:
p
case 3:
setBackground(Color.yellow);
break;
case 4:
t
t
h
setBackground(Color.magenta);
break;
case 5:
setBackground(Color.white);
break;
}}
else if(flag==3)
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
{
g.drawImage(img,20,90,this);
}}
public boolean action(Event e,Object o)
{
for(int i=0;i<5;i++)
{
if(e.target==buttons[i])
/
k
t
.
e
b
currcolor=i;
u
t
e
s
c
/
return true;
/
:
p
}}
return false;
}}
t
t
h
HTML CODING:
<html>
<head>
<title>color palette</title>
<applet code="exp5.class" width=400 height=400>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
</applet>
</head>
</html>
OUTPUT:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a java servlet program to conduct online examination and to display student
mark list available in a database.
ALGORITHM:
HTML FILE:
/
k
t
.
e
b
u
t
e
JAVA FILE:
s
c
/
Import the necessary packages and declare class, class name in exam.
Declare the connection, statement and result set object.
Use the depost() for check the connection in JDBC:ODBC driver.
The data are insert into corresponding table.
The execute update() are update the database.
Display the table in after html file compilation.
/
:
p
t
t
h
PROGRAM:
html coding:
<html>
<head>
<title> Database test</title>
</head>
<body>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<center>
<form action="http://localhost:8080/examples/servlet/exam" method=POST>
<div align="left"><br>
<b>seat number:</b> <input type="text" name="Seat_no">
<div align="right"><br>
<b>Name:</b> <input type="text" name="Name" size="50"><br>
</div>
<br>
/
k
t
<br>
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<br><br><br>
<center>
<input type="submit" value="submit"><br><br>
</center>
</form>
</body>
</html>
/
k
t
java coding
.
e
b
u
t
e
import java.sql.*;
import java.io.*;
s
c
/
import java.util.*;
/
:
p
import javax.servlet.*;
import javax.servlet.http.*;
t
t
h
String message,Seat_no,Name,ans1,ans2,ans3,ans4,ans5;
int Total=0;
Connection connect;
Statement stmt =null;
ResultSet rs=null;
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
{
try
{
String url="jdbc:odbc:StudentDB2";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connect=DriverManager.getConnection(url," "," ");
message="Connection Successful";
}
/
k
t
catch(ClassNotFoundException cnfex)
.
e
b
u
t
e
cnfex.printStackTrace();
}
s
c
/
catch(SQLException sqlex)
/
:
p
sqlex.printStackTrace();
}
t
t
h
catch(Exception excp)
{
excp.printStackTrace();
}
Seat_no=request.getParameter("Seat_no");
Name=request.getParameter("Name");
ans1=request.getParameter("group1");
ans2=request.getParameter("group2");
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
ans3=request.getParameter("group3");
ans4=request.getParameter("group4");
ans5=request.getParameter("group5");
if(ans1.equals("True"))
Total+=2;
if(ans2.equals("False"))
Total+=2;
if(ans3.equals("True"))
/
k
t
Total+=2;
.
e
b
if(ans4.equals("True"))
u
t
e
Total+=2;
if(ans5.equals("False"))
s
c
/
Total+=2;
/
:
p
try
{
t
t
h
Statement stmt=connect.createStatement();
String query="insert into
StudentTable("+Seat_no+",'"+Name+"',"+Total+")";//*****"+"Seat_no,Name,Marks"+")"+" VALUES("
int result=stmt.executeUpdate(query);
stmt.close();
}
catch(SQLException ex)
{
}
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
response.setContentType("text/html");
PrintWriter out=response.getWriter();
out.println("<html>");
out.println("<body bgcolor=yellow>");
out.println("<h1>"+message+"</h1>\n");
out.println("<h3>DataBase Updated");
out.println("<br><br>");
out.println("<b>"+"The Student Database is as follows");
/
k
t
out.println("<table border=5>");
.
e
b
try
u
t
e
{
Statement stmt=connect.createStatement();
s
c
/
/
:
p
rs=stmt.executeQuery(query);
out.println("<th>"+"Seat_no"+"</th>");
t
t
h
out.println("<th>"+"Name"+"</th>");
out.println("<th>"+"Marks"+"</th>");
while(rs.next())
{
out.println("<tr>");
out.println("<td>"+rs.getInt(1)+"</td>");
out.println("<td>"+rs.getString(2)+"</td>");
out.println("<td>"+rs.getInt(3)+"</td>");
out.println("</tr>");
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
}
out.println("</table>");
}
catch(SQLException ex)
{}
finally
{
try
/
k
t
.
e
b
if(rs!=null)
u
t
e
rs.close();
if(stmt!=null)
s
c
/
stmt.close();
/
:
p
if(connect!=null)
connect.close();
}
t
t
h
catch(SQLException e)
{}
}
out.println("<center>");
out.println("<h1>Thanks!</h1>\n");
out.println("</center>");
out.println("</body></html>");
}}
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
Output:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a program for implementing student information using XML & XSL.
ALGORITHM:
/
k
t
.
e
b
u
t
e
PROGRAM:
s
c
/
//SimpleXML.xml
<?xml version="1.0" encoding="UTF-8"?>
/
:
p
t
t
h
<name>Raj</name>
<address>Chennai</address>
<std>Third</std>
<marks>89 percent</marks>
</person-Details>
<person-Details>
<name>Ram</name>
<address>Chennai</address>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<std>Third</std>
<marks>98 percent</marks>
</person-Details>
<person-Details>H
<name>Raju</name>
<address>madurai</address>
<std>Third</std>
<marks>90 percent</marks>
/
k
t
</person-Details>
.
e
b
<person-Details>
u
t
e
<name>Ragav</name>
<address>erode</address>
s
c
/
<std>Third</std>
/
:
p
<marks>73 percent</marks>
</person-Details>
</Student>
t
t
h
SimpleXml.xsl
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<h2>Student DataBase</h2>
<table border="1">
<tr bgcolor="red">
<th>Name</th>
<th>Address</th>
<th>Standard</th>
<th>Marks</th>
</tr>
/
k
t
<xsl:for-each select="Student/person-Details">
.
e
b
<tr bgcolor="pink">
u
t
e
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="address"/></td>
s
c
/
<td><xsl:value-of select="std"/></td>
/
:
p
<td><xsl:value-of select="marks"/></td>
</tr>
</xsl:for-each>
</table>
t
t
h
</body>
</html>
</xsl:template>
</xsl:stylesheet>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
OUTPUT:
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a program for implementing student information XML document is well formed
or not using DOM.
ALGORITHM:
/
k
t
In java program, import the necessary package and declare the class parsing-DOM demo.
In that main function display enter the name of the XML document and get the input
from the buffer reader object.
Then create a file object and it assign to buffered reader value.
The input source is filename, then it is well formed otherwise it is not well formed.
In XML program create the student information and the java file complete and display
the output.
.
e
b
u
t
e
s
c
/
/
:
p
PROGRAM:
Java Coding:
t
t
h
//Parsing_DOMDemo.java
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
public class Parsing_DOMDemo
{
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
if(fp.exists())
.
e
b
u
t
e
try
{
s
c
/
DocumentBuilderFactory Factory_obj=DocumentBuilderFactory.newInstance();
/
:
p
DocumentBuilder builder=Factory_obj.newDocumentBuilder();
InputSource ip_src=new InputSource(file_name);
t
t
h
Document doc=builder.parse(ip_src);
System.out.println(file_name+"is well formed!");
}
catch(Exception e)
{
System.out.println(file_name+"is not well-formed!");
System.exit(1);
}
}
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
else
{
System.out.print("File not found!");
}
}
catch(IOException ex)
{
ex.printStackTrace();
/
k
t
.
e
b
u
t
e
s
c
/
XML Cding:
//Student1.xml:
/
:
p
t
t
h
<?xml version="1.0"?>
<student>
<Roll_No>10</Roll_No>
<Personal_Info>
<Name>Parth</Name>
<Address>Pune</Address>
<Phone>12345672</Phone>
</Personal_Info>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
<class>Second</class>
<Subject>Mathematics</Subject>
<Marks>100</Marks>
<Roll_No>20</Roll_No>
<Personal_Info>
<Name>Anu</Name>
<Address>Banglore</Address>
<Phone>78956897</Phone>
/
k
t
</Personal_Info>
.
e
b
<class>Fifth</class>
u
t
e
<Subject>English</Subject>
<Marks>90</Marks>
s
c
/
<Roll_No>30</Roll_No>
/
:
p
<Personal_Info>
<Name>priya</Name>
t
t
h
<Address>Trichy</Address>
<Phone>78956897</Phone>
</Personal_Info>
<class>Fifth</class>
<Subject>Tamil</Subject>
<Marks>90</Marks>
</student>
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
OUTPUT:
C:\Documents and Settings\user>cd C:\Program Files\Java\jdk1.6.0_13\bin
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a program for student information XML document is well-formed or not using
SAX.
/
k
t
ALGORITHM:
.
e
b
In java program, input the necessary packages and declare the classname is parsingSAXDEMO.
In the main function display the Enter the XML document name manage and it get the
buffered reader object.
A new file is created and it exists then it is well formed, otherwise its not well formed.
Else file is not passed message will be displayed.
In XML document create the student information.
u
t
e
s
c
/
/
:
p
PROGRAM:
import java.io.*;
t
t
h
import org.xml.sax.*;
import org.xml.sax.helpers.*;
public class Parsing_SAXDemo
{
public static void main(String[] args) throws IOException
{
try
{
System.out.print("Enter the name of XML document");
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
reader.parse(file_name);
System.out.print(file_name+"is well-formed.");
.
e
b
}
catch(Exception e)
u
t
e
s
c
/
/
:
p
}
t
t
h
else
{
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
//student.xml
<?xml version="1.0"?>
<student>
<Roll_no>10</Roll_no>
<Personal_Info>
<Name>path</Name>
<Address>Pune</Address>
<phone>1234567890</phone>
</Personal_Info>
/
k
t
<class>Second</class>
<Subject>Mathematics</Subject>
.
e
b
<Marks>100</Marks>
u
t
e
</student>
OUTPUT:
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To write a html program using AJAX.
ALGORITHM:
/
k
t
.
e
b
u
t
e
PROGRAM:
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
AIM:
To create an airline reservation service and a travel agent and the travel agent is searching
for an airline using webservices and database.
/
k
t
ALGORITHM:
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
http://csetube.weebly.com/
GKMCET
LAB PROGRAMS & ALGORITHM
Subject Code : CS2358
/
k
t
.
e
b
u
t
e
s
c
/
/
:
p
t
t
h
RESULT:
http://csetube.weebly.com/