0% found this document useful (0 votes)
82 views40 pages

WEB Technology Lab Manual

This document describes developing an application for FTP download. It involves creating a client socket and input/output streams for the client socket. The file is retrieved from the server using input streams. An FTP server socket is created to send files to the FTP client. The client connection is accepted and files are sent to the client using output streams. The data is read from the server at the client using readLine and displayed.

Uploaded by

Sendhil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views40 pages

WEB Technology Lab Manual

This document describes developing an application for FTP download. It involves creating a client socket and input/output streams for the client socket. The file is retrieved from the server using input streams. An FTP server socket is created to send files to the FTP client. The client connection is accepted and files are sent to the client using output streams. The data is read from the server at the client using readLine and displayed.

Uploaded by

Sendhil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 40

Ex.

No : 1A
Date : WEB PAGE CREATION
AIM :
To develop a web page for Password authentication using HT! and "cripting
!anguages
ALGORITHM :
1. "tart
#. Define the for$ tag with userna$e % password and &utton ele$ents
'. (rite the )ava script function in the header of *our HT! using "cript tag to
chec+ the password na$e.
,. -f the password is admin then displa* the (elco$e essage.
.. -f the password is invalid or /serna$e blan+ the displa* the alert $essage
0Password (rong or /serna$e blan+ 1
2. "top
1
PROGRAM :
<html>
<head>
<title> Password authentication using Java Script</title>
<script language="javascript">
function validate(form1
!
if((form1"pass"value=="admin" ##(form1"uname"value$= " "
!
document"%gcolor="gra&"'
document"write("(i " )"<(*><+><font color =,%lue,>") form1"uname"value
)"</font></(*>"'
document"writeln(" -elcome to the Student Portal "'
.
else
alert(,-rong Password or /sername +lan0,'
.
</script>
<%od&>
<form name="form1">
<h1><center> 1234 Student 5ogin </center></h1>
<(6>
<321726>
/ser 1ame 8 <input t&pe="te9t" name="uname" value=" " ><%r>
Password 8 <input t&pe ="password" name="pass" value= " "> <%r>
<input t&pe ="%utton" name="su%" value="5ogin" on3lic0 =
"validate(form1'">
</321726>
</form>
</%od&>
</html>
#
OUTPUT :
Result:
Thus the web page for password authentication using HT! and scripting
languages has been created and verified successfull*.
'
Ex. No : 1& WEB PAGE CREATION
Date :
AIM :
To 3reate a (eb page for 4nline E5 ail 6egistration for$ using HT!
ALGORITHM :
1. "tart
#. Define the 746 tag .
'. Define 746 Ele$ent Text&ox for /serna$e% Date of &irth% Age and Address
,. Define 746 Ele$ent Password for password field
.. Define 6adio &utton for "ex option
2. Define "elect tag for Educational 8ualification% Nativit*% 9ob profile
:. Define 3hec+ box for Hobbies and "oftware Exposure
;. Define "ub$it button to invo+e server to send the for$ content to the server
<. =alidate password field using 9ava "cript. -f the password is less than '
character then displa* the error $essage
1>. "top
PROGRAM :
,
?HT!@
?HEAD@?T-T!E@ E5 ail 6egistration 7or$ ?AT-T!E@
?script languageBC)avascriptC@
function validateDE
F
ifDf1.una$e.valueGB C C HH f1.pass.valueGBC CE
alertDI6egistration "uccessfulIEJ
else
alertDI/serna$e 46 Password E$pt*IEJ
K
?Ascript@?Ahead@
?bod*@
?for$ na$e B Cf1C@
?h1@?center@ ail 6egistration 7or$ ?Acenter@?Ah1@
?pre@
?74NT colorBCblueC @?b@Personal Details?Ab@?Afont@
?H6@
/ser Na$e : ?input t*pe BCTextC na$e BCuna$eC value B C C@ ?br@
password : ?input t*pe BCpasswordC na$e BCpassC value B C C@Dust be greater
than ' charE?&6@
Na$e : ?input t*pe BCtextC na$e BCfna$eC value B C C @ ?br@
Age : ?input t*pe BCtextC na$e BCage C value B C C @ ?br@
"ex : ?input t*pe BCradioC na$e BC$ale C valueB CaleC chec+ed@ ale
?input t*pe BCradioC na$e BCfe$ale C valueB C7e$aleC chec+ed@ 7e$ale ?br@
Date of &irth : ?input t*pe BCtextC na$e BCdob C valueB C C @ ?br@
?74NT colorBCblueC @?b@8ualification and Profession?Afont@?Ab@
?H6@
8ualification : ?select@ ?option@ &E. &.Tech?A4PT-4N@
?4PT-4N@ 3A?A4PT-4N@
?option@."c?Aoption@
?option@4thers?Aoption@
?Aselect@?br@?br@?br@
Profession : ?select@?option@ "oftware Develop$ent?Aoption@
?option@ anage$ent Executive?Aoption@
?option@ &an+ing Executive ?Aoption@
?option@ Teaching ?Aoption@
?option@ 4thers ?Aoption@
?Aselect@?br@
Hobbies :?input t*pe BCchec+boxC na$eBCga$esC value BCLa$esC@La$es
?input t*pe BCchec+boxC na$eBCsprotsC value BCsprotsC@"ports
?input t*pe BCchec+boxC na$eBCsurfingC value BCNet "urfingC@Net
"urfing?br@?br@?br@
?center@ ?input t*pe B CbuttonC na$eBCsubC value BC6egisterC on3lic+ B
CvalidateDEJC@?Acenter@
?Afor$@
?Abod*@
?Aht$l@
OUTPUT :
.
2
Result :
Thus the (eb page for 4nline E5 ail 6egistration for$ using HT! is
created and verified successfull*.
Ex. No : 13 WEB PAGE CREATION
Date:
:
AIM :
To develop a web page to displa* *our depart$ent details using 7ra$es %
7ra$eset % H*perlin+s and other tags
ALGORITHM :
1. "tart
#. Divide the browser into three fra$es using 7ra$e and 7ra$eset Tags
'. 3reate a web page to displa* 3ollege na$e on the top of the page
,. 3reate a page for side $enu which consist of lin+ to courses offered% lab
facilities and Place$ent details of *our depart$ent
.. 3reate a web page course infor$ation which contains courses offered b* the
depart$ent
2. 3reate a web page for lab facilities
:. 3reate a web page to displa* place$ent record of *our depart$ent
;. "top
PROGRAM :
;
Main.html
?ht$l@
?head@
?title@ Lnana$ani 3ollege of Technolog* ?Atitle@
?Ahead@
?7ra$eset rowsBC#.M%:.MC@
?fra$e srcBCcollege.ht$lC@
?fra$eset colsBC#.M%:.MC@
?fra$e srcBCside.ht$lC@
?fra$e srcBCwelco$e.ht$lC na$eBf'@
?Afra$eset@
?Afra$eset@
?Aht$l@
Collee.html
?ht$l@
?Head@
?title@ Lnana$ani 3ollege of Technolog* ?Atitle@
?Ahead@
?bod* bgcolorBCd'a;ffC bac+groundBCb1.gifC@
?center@?H1 @?font colorBCffff2#C @ Lnana$ani 3ollege of Technolog* ?Afont@?Ah1@
?font faceBCbradle* hand itcC colorBCffff2#C@Na$a++al?Afont@?br@
?Acenter@
?$arNuee &EHA=-46BCalternateC@ ?pre@ ?font faceBCbroadwa*C colorBff>>>>@T E
P ! E 47 ! E A 6 N - N L ?Afont@?Apre@?AA68/EE@
?Abod*@
?Aht$l@
!ide.html
?HT!@
?HEAD@?T-T!E@"-DE EN/?AT-T!E@?AHEAD@
?&4DO@
Dept. of 3"E?&6@
?hr@
?A href B Ccourse.ht$lC target B Pf'Q @ 3ourses?&6@
?A href BC lab.ht$l C target BQf'Q @ !ab Details?Abr@
?A href BC place.ht$lC target B Pf'Q @Place$ent ?Abr@
?Abod*@
?Aht$l@
Wel"ome.html
?ht$l@
<
?HEAD@?T-T!E@"-DE EN/?AT-T!E@?AHEAD@
?&4DO@
?center@ ?h1@?font color BCblueC @ (elco$e to 3"E Depart$ent
?Afont@?Ah1@?Acenter@
?Abod*@
?Aht$l@
Cou#se.html
?ht$l@
?bod*@
?H'@?3ENTE6@?font color BCredC @Progra$$e 4ffered ?Afont@?Acenter@?Ah'@
?4!@
?!-@ &.E 3o$puter "cience and Engineering
?!-@ .E 3o$puter "cinece and Engineering
?Aol@
?Abod*@
?Aht$l@
la$.html
?ht$l@
?bod*@
?H'@?3ENTE6@?font color BCredC @!ab facilities ?Afont@?Acenter@?Ah'@
?p@
The depart$ent has . 3o$puter centre with '.> s*ste$s.
All the co$puter centres are eNuipped with latest Pentiu$ $achines with sufficient
power facilities.
All the co$puter centers are air conditioned.
The depart$ent has separate centre for -nternet browsing. The internet browsing centre
open on all wor+ing da*s fro$ <.>> a$ to <.>> p.$.
?p@
?Abod*@
?Aht$l@
Pla"e.html
?ht$l@
?bod*@
?H'@?3ENTE6@?font color BCredC @Place$ent Details ?Afont@?Acenter@?Ah'@
Totall* .. students of our depart$ent have been placed through various co$panies
with good pac+age. The list of co$panies where our students placed are
?ol@
?li@ T3"
?!-@ 3T"
?li@ (ipro Technologies
?li@ "at*a$ 3o$ptuers
?li@ Hexaware Technologies
?Aol@
?Abod*@
?Aht$l@
1>
OUTPUT :
11
Result:
Thus the web page to displa* Depart$ent details using 7ra$es% 7ra$eset%
H*perlin+s and other tags has been created and verified successfull*
1#
Ex. No : #
Date : GETTING %ATE & TIME 'ROM TCP !ER(ER
AIM :
To develop a T3P "oc+et progra$ to retrieve date and ti$e fro$ the T3P
"erver
ALGORITHM :
1. "tart
#. 3reate a T3P "erver soc+et with port nu$ber using "erver"oc+et class
'. 3onnect to the T3P 3lient soc+et
,. Establish input and output strea$ for the "erver "oc+et
.. 3reate a T3P 3lient soc+et suing "oc+et class and bind the 3lient to the server
soc+et
2. Establish input and output strea$ for the 3lient "oc+et
:. Accept the client soc+et using acceptD E $ethod
;. 6etrieve the Date and ti$e using Date class at the server side and send it to the
T3P client
<. 6etrieve the result fro$ the T3P "erver at the T3P 3lient and displa* the date
and ti$e at the 3lient "ide
1>. "top
1'
PROGRAM:
TCP !e#)e#
import java"net":'
import java"io":'
import java"util":'
import java"te9t":'
class 6emoteServer
!
pu%lic static void main(String a;< throws 29ception
!
ServerSoc0et ser'
Soc0et s'
PrintStream p'
=ata>nputStream p1'
ser=new ServerSoc0et(?@@@'
s=ser"accept('
while(true
!
tr&
!
p=new PrintStream(s"getAutputStream('
p"println("(ai toda& date is " ) new =ate('
.
catch(>A29ception e
!
S&stem"out"println("3lient terminated"'
S&stem"e9it(1'
.
.
.
.
TCP Client
import java"io":'
import java"net":'
class 6emote3lient
!
pu%lic static void main(String a;<
!
Soc0et s'
String hn'
=ata>nputStream ds'
=ata>nputStream u>'
PrintStream ps'
String s1'
tr&
!
s=new Soc0et(>netBddress"get5ocal(ost(C?@@@'
ds=new =ata>nputStream(s"get>nputStream('
ps=new PrintStream(s"getAutputStream('
u>=new =ata>nputStream(S&stem"in'
S&stem"out"println("3onnected with the server"'
S&stem"out"println("7&pe an& (ellA Dessage to
1,
retrieve =ate and 7ime"'
S&stem"out"println("7&pe e9it to disconnect"'
while(true
!
s1=u>"read5ine('
if(s1"eEuals("e9it" %rea0'
ps"println(s1'
S&stem"out"println(ds"read5ine('
.
.
catch(/n0nown(ost29ception e
!
S&stem"out"println(e'
.
catch(>A29ception e1
!
S&stem"out"println(e1'
.
.
.
1.
OUTPUT
!e#)e# Windo*
Client Windo*
Result:
Thus the T3P "oc+et progra$ to retrieve Date and Ti$e fro$ the T3P "erver
has been executed and verified successfull*
12
Ex. No : 'A
Date : 'TP %OWNLOA%
AIM :
To develop a application for 7TP Download
ALGORITHM :
1. "tart
#. 3reate 3lient "oc+et using "oc+et $ethod
'. 3reate input strea$ and output "trea$ for the 3lient soc+et
,. Let the file fro$ the server using input strea$s
.. 3reate 7TP "erver soc+et to send files to the 7TP 3lient
2. /se accept DE $ethod to accept the 7TP 3lient connection
:. "end the files to 7TP 3lient using output strea$ ob)ect
;. 6ead the data fro$ the 7TP "erver at the client side and obtains the data using
read!ineDE $ethod of the strea$
<. Displa* the data obtained fro$ the server
1>. "top
1:
PROGRAM
%o*nloadin + 'TP Client
i$port )ava.io.RJ
i$port )ava.net.RJ
public class ftpc
F
public static void $ainD"tring argsSTEthrows -4Exception
F
"oc+et sBnullJ
Data-nput"trea$ siBnullJ

sBnew "oc+etD-netAddress.get!ocalHostDE%.....EJ
siBnew Data-nput"trea$Ds.get-nput"trea$DEEJ

Data-nput"trea$ inpBnew Data-nput"trea$D"*ste$.inEJ
Data4utput"trea$ soBnew Data4utput"trea$Ds.get4utput"trea$DEEJ
"tring strJ

"*ste$.out.printlnDCUn Enter the filena$eDpathE : CEJ
strBinp.read!ineDEJ
so.write&*tesDstrEJ
so.write&*tesDCUnCEJ

7ile4utput"trea$ fosBnew 7ile4utput"trea$DCabc1.txtCEJ
int str1J
"*ste$.out.printlnDCTransferring the file :CVstrVC UnCEJ

whileDDstr1Bsi.readDEEGB51E
F
fos.writeDDcharEstr1EJ
"*ste$.out.printDDcharEstr1EJ
K

"*ste$.out.printlnDCUn 7ile received successfull*CEJ

si.closeDEJ
K
K
%o*nloadin + 'TP !e#)e#
i$port )ava.io.RJ
i$port )ava.net.RJ
class ftps
F
public static void $ainD"tring argsSTEthrows -4Exception
1;
F
"oc+et sBnullJ
"erver"oc+et ssBnullJ
Data4utput"trea$ ssoBnullJ
Data-nput"trea$ sinBnullJ
ssBnew "erver"oc+etD.....EJ
"*ste$.out.printlnDC(aitingCE J
sBss.acceptDEJ
ssoBnew Data4utput"trea$Ds.get4utput"trea$DEEJ
sinBnew Data-nput"trea$Ds.get-nput"trea$DEEJ
"tring s1J
s1Bsin.read!ineDEJ
7ile-nput"trea$ fosBnew 7ile-nput"trea$Ds1EJ
int strJ
whileDDstrBfos.readDEEGB51E
sso.write&*tesDCCVDcharEstrEJ
"*ste$.out.printlnDC7ile has been sent successfull*CEJ
sso.closeDEJ
s.closeDEJ
K
K
1<
OUTPUT :
'TP %o*nload Client
'TP %o*nload !e#)e#
Result:
Thus the progra$ to Download files fro$ 7TP "erver has been executed and
verified successfull*.
#>
Ex. No : '&
Date : 'TP UPLOA%
AIM :
To develop a application for 7TP /pload
ALGORITHM :
1. 1."tart
#. 3reate 3lient "oc+et using "oc+et $ethod
'. 3reate input strea$ and output "trea$ for the 3lient soc+et
,. Let the file fro$ the server using input strea$s
.. 3reate 7TP "erver soc+et to receive files fro$ the 7TP 3lient
2. /se accept DE $ethod to accept the 7TP 3lient connection
:. /pload the files to 7TP 3lient using output strea$ ob)ect
;. 6ead the data fro$ the 7TP 3lient at the server side
<. "tore the data received fro$ client in the server side
1>. "top
#1
PROGRAM :
U,loadin + 'TP Client
i$port )ava.io.RJ
i$port )ava.net.RJ
public class ftpuc
F
public static void $ainD"tring argsSTEthrows -4Exception
F
"oc+et sBnullJ
Data-nput"trea$ siBnullJ

sBnew "oc+etD-netAddress.get!oalHostDE%.....EJ
siBnew Data-nput"trea$Ds.get-nput"trea$DEEJ
Data-nput"trea$ inpBnew Data-nput"trea$D"*ste$.inEJ
Data4utput"trea$ soBnew Data4utput"trea$Ds.get4utput"trea$DEEJ
"tring strJ

"*ste$.out.printlnDCUn Enter the filena$eDpathE : CEJ
strBinp.read!ineDEJ
int iJ

7ile-nput"trea$ fosBnew 7ile-nput"trea$DstrEJ
whileDDiBfos.readDEEGB51E
so.write&*tesDCCVDcharEiEJ

si.closeDEJ KK
U,loadin - 'TP !e#)e#
i$port )ava.io.RJ
i$port )ava.net.RJ
class ftpus
F
public static void $ainD"tring argsSTEthrows -4Exception
F
"oc+et sBnullJ
"erver"oc+et ssBnullJ
Data4utput"trea$ ssoBnullJ
Data-nput"trea$ sinBnullJ
ssBnew "erver"oc+etD.....EJ
"*ste$.out.printlnDC(aitingCE J
sBss.acceptDEJ
ssoBnew Data4utput"trea$Ds.get4utput"trea$DEEJ
sinBnew Data-nput"trea$Ds.get-nput"trea$DEEJ
7ile4utput"trea$ fosBnew 7ile4utput"trea$DCabc1.txtCEJ
int str1J

##

whileDDstr1Bsin.readDEEGB51E
F
fos.writeDDcharEstr1EJ
"*ste$.out.printDDcharEstr1EJ
K

sso.closeDEJ
s.closeDEJ
KK
#'
OUTPUT :
'TP U,load !e#)e#
'TP U,load Client
Result:
Thus the progra$ to /pload files to 7TP "erver has been executed and verified
successfull*.
#,
Ex. No : ,
Date : .%BC CONNECTI(IT/
AIM
To write a )ava progra$ for 9D&3 3onnectivit*
ALGORITHM :
1. "tart
#. -nstall the 9D&3 Driver using forNa$e DE $ethod
'. 3reate a table with reNuired fields.
,. 3reate a data source using 4D&3 Data source in windows
.. Establish connection to the Data source using get3onnectionDE ethod
2. 3reate a state$ent ob)ect in the above connection ob)ect in order to send Nuer*
to the table
:. "end the Nuer* to the table using execute8uer*DE $ethod
;. "tore the results in the 6esult"et ob)ect
<. Displa* the result on the screen
1>. "top
#.
PROGRAM :
i$port )ava.sNl.RJ
class odbctest
F
public static void $ainD"tring aSTE
F
tr*
F
3lass.forNa$eDCsun.)dbc.odbc.9dbc4dbcDriverCEJ
3onnection cBDriveranager.get3onnectionDC)dbc:odbc:nandhaCEJ
"tate$ent sBc.create"tate$entDEJ
6esult"et rsJ
"tring NBCselect R fro$ studCJ
rsBs.execute8uer*DNEJ
"*ste$.out.printlnDCNa$eUtUtUt&ranchUtUt3lassUtUtLrade CEJ
"*ste$.out.printlnDC5555UtUtUt555555 UtUt55555UtUt55555CEJ
whileDrs.nextDEE
F
"*ste$.out.printDrs.get"tringD1EVCUtUtCEJ
"*ste$.out.printDrs.get"tringD#EVCUtUtCEJ
"*ste$.out.printDrs.get"tringD'EVCUtUtCEJ
"*ste$.out.printlnDrs.get"tringD,EVCUtUtCEJ
K
KcatchDException eE
F
"*ste$.out.printlnDCErrorCVeEJ
K
K
K
#2
OUTPUT
Result:
Thus the 9D&3 3onnectivit* progra$ has been executed and verified
successfull*.
#:
Ex. No : .
Date : OR%ER PROCE!!ING - .!P
AIM :
To develop a server side progra$ using 9"P to perfor$ 4rder Processing
ALGORITHM :
1. "tart
#. Develop a client application using HT! to get the order fro$ the user. The
order should consist of 4rder No% Date% 8uantit* and 6e$ar+
'. 3reate a server side page using 9"P to read order details
,. 9D&3 3onnection is established to read the order detail at the server side
.. /se getPara$eterDE $ethod to read the client side details
2. "end the response to the reNuest via out ob)ect of 9"P
:. "top
#;
PROGRAM :
?ht$l@
?bod*@
?7or$ na$eBf1 actionBChttp:AAlocalhost:;>;>Aexa$plesA)spAsorder.)spC@
?h1@?center@?font colorBCblueC@ A&3 -ndustries Pvt. !td. ?Afont@?Acenter@?Ah1@
?hr@
?H#@?center@ 4rder Details ?Ah#@
?pre@
3usto$er Na$e : ?input t*peBtext na$eBCcna$eC@
4rder No : ?input t*peBtext na$eBCornoC@
4rder Date : ?input t*peBtext na$eBCordateC@
-te$ na$e : ?input t*peBradio na$eBCite$C valueBC"oapC chec+ed@ "oap ?input
t*peBradio na$eBCite$C valueBCPowderC@ Powder
8uantit* : ?input t*peBtext na$eBCNuanC@
6e$ar+s : ?input t*peBtext na$eBCre$ar+sC@
?input t*peB"ub$it valueBC4rder-te$C @ ?input t*peBreset@
?Afor$@
?Acenter@
?Aht$l@
O#de#sa)e.0s,
?ht$l@
?MW page i$portBC)ava.sNl.RC M@
?M
tr*
F
3onnection cBnullJ
3lass.forNa$eDCsun.)dbc.odbc.9dbc4dbcDriverCEJ
cBDriveranager.get3onnectionDC)dbc:odbc:nandhaCEJ
"tate$ent sJ
sBc.create"tate$entDEJ
"tring cna$eBreNuest.getPara$eterDCcna$eCEJ
"tring ornoBreNuest.getPara$eterDCornoCEJ
#<
"tring ordateBreNuest.getPara$eterDCordateCEJ
"tring ite$BreNuest.getPara$eterDCite$CEJ
int NuanB-nteger.parse-ntDreNuest.getPara$eterDCNuanCEEJ
"tring re$ar+sB reNuest.getPara$eterDCre$ar+sCEJ
"tring NBCinsert into order
valuesDICVcna$eVCI%ICVornoVCI%ICVordateVCI%CVNuanVC%ICVite$VCI%ICVre$ar+sVCIECJ
s.execute/pdateDNEJ
out.printDC?h#@-nserted?h#@CEJ
K
catchDException eE
F
out.printDeEJ
K
M@
?Aht$l@
'>
OUTPUT
'1
Result:
Thus the 4rder Processing using 9"P has been executed and verified
successfull*.
'#
Ex. No : >2
Date :
AIM
To create server side page to displa* results of a student using "ervlet
ALGORITHM
1. "tart
#. Develop client side application using HT!
'. Enter the register nu$ber at the client side HT! 7ro$
,. -nvo+e the servlet for$ the client side application
.. Develop a Http base servlet to displa* student exa$ results
2. 6ead the register fro$ the reNuest ob)ect of servlet interface
:. 3hec+ the availabilit* of the register in the data base using 9D&3 3onnectivit*
;. -f the register nu$ber is available retrieve the results using execute8uer*DE
$ethod.
<. "end bac+ the result to the client via response ob)ect
1>. "top
''
PROGRAM
Client side ,#o#am
?HT!@
?HEAD@?T-T!E@ 6esults of a student?Atitle@?Ahead@
?bod*@
?center@?h'@ /niversit* Exa$ination 6esults 9ul* #>>; ?Ah'@?Acenter@
?for$ $ethod B CLETC
actionBChttp:AAlocalhost:;>;>Aexa$plesAservletADispla*6esultC@
Enter 6egister Nu$ber : ?input t*pe BCtextC na$eBCregnoC valueB C C@
?input t*pe BCsub$itC valueBCLet6esultC@
?Afor$@
?Abod*@
?Aht$l@
!e#)let P#o#am
i$port )ava.io.RJ
i$port )avax.servlet.RJ
i$port )avax.servlet.http.RJ
i$port )ava.sNl.RJ
public class Displa*6esult extends Http"ervlet F
3onnection conJ
"tate$ent stJ
6esult"et rsJ
public void initDE
F
tr*
F
3lass.forNa$eDCsun.)dbc.odbc.9dbc4dbcDriverCEJ
con B
Driveranager.get3onnectionDC)dbc:odbc:nandhaC%CC%CCEJ
"*ste$.out.printlnDC3onnection 3reatedCEJ
stB con.create"tate$entDEJ
K
catchDException eE
F
"*ste$.out.printlnDeEJ
K
K
public void doLetDHttp"ervlet6eNuest reNuest% Http"ervlet6esponse responseE
throws -4Exception% "ervletException
',
F
response.set3ontentT*peDCtextAht$lCEJ
Print(riter out B response.get(riterDEJ


6esult"et rsJ
"tring NrBCCJ
tr*
F
out.printlnDC?ht$l@CEJ
out.printlnDC?bod*@CEJ
out.printlnDC?head@CEJ
out.printlnDC?title@ 6esults ?Atitle@CEJ
out.printlnDC?Ahead@CEJ
out.printlnDC?bod*@CEJ
out.printDC?h'@6esults of C V reNuest.getPara$eterDCregnoCEVC?AH'@CEJ

rsBst.execute8uer*DCselect R fro$ rtable where
rnoBICVreNuest.getPara$eterDCregnoCEVCICEJ
out.printlnDC?h'@?pre@ ?74NT 34!46BI&!/EI@ "ub)ect Na$e Lrade
?A74NT@?AH'@?Apre@CEJ
ifDrs.nextDEE
F

out.printDC?h,@ Database Technolog* : C V rs.get"tringD#EVC?Ah,@CEJ
out.printDC?h,@ 3o$piler Design : C V rs.get"tringD'EVC?Ah,@CEJ
out.printDC?h,@ 4b)ect 4riented Anal*sis and Design J C V
rs.get"tringD,EVC?Ah,@CEJ
out.printDC?h,@ (eb Technolog* : C V rs.get"tringD.EVC?Ah,@CEJ
out.printDC?h,@ -nfor$ation "ecurit* : C V rs.get"tringD2EVC?Ah,@CEJ
out.printDC?h,@ High "peed Networ+s : C V rs.get"tringD:EVC?Ah,@CEJ
K
else
F
out.printlnDC?h1@-nvalid 6egister Nu$ber?Ah1@CEJ
K K
catchDException eE
F
out.printlnDC?h1@CVNrVC?br@CVeVC?Ah1@CEJ
K
finall*
F
out.printlnDC?Abod*@CEJ
out.printlnDC?Aht$l@CEJ
out.closeDEJ
K

K
K
'.
OUTPUT
Client side A,,li"ation
!e#)let Out,ut
'2
':
Ex. No : :
Date : A!P - COMPONENT!
AIM :
To develop a web page using A"P 3o$ponents
ALGORITHM :
1. "tart
#. 3reate a Text file which contains the co$ponent to be displa*ed. The text file
$a* contain pictures% lin+ to web page etc.
'. 3reate a 4b)ects in the A"P 3o$ponents using 3reate4b)ect DE $ethod
,. The LetAdvertise$ent $ethod is used to get details fro$ the text file
.. Displa* the co$ponent using response ob)ect
2. Test the A"P Page and displa* the result
:. "top
';
PROGRAM :
Ad#otato#.as,:
?ht$l@
?bod*@
?M
set adrotatorB"erver.3reate4b)ectDC"(3.Ad6otatorCE
response.writeDadrotator.LetAdvertise$entDCads.txtCEE
M@
?Abod*@
?Aht$l@
Ads.t1t:
R
w'schools.gif
http:AAwww.w'schools.co$A
=isit ('"chools
;>
roses.gif
http:AAwww.$icrosoft.co$A
=isit icrosoft
#>
'<
Out,ut:
Result:
Thus the web page using A"P 3o$ponents has been created and verified
successfull*
,>

You might also like