Java
Java
:ITA-30_Class:YB
R.P. Gogate College of Arts &Science DateExperiment No.:.
and R. V. Jogalekar College of Commerce,
Semester .Signature
(AUTONOMOUS) Ratnagiri.
DEPARTMENT OF INFORMATION TECHNOLOGY
is apndnd to th VRL as a
guey para ten
Tynlcolly usd doY netu ing data
talung
posT:
-JDato is ssnt In the
oequest
Typlcaly usro dor hod& Hrre
Sor SuDmittin the
data that changs ths!
(itoting state on the
The datais nat \S)
maling
sar snSte dota
SecUe than GET
a Creote o sirnple
using
Program
a serlat
0uplicotan
indxhtrml
2100CTYPE htm
Lhtm>
<heod <Whegd)
<bady
KEarro mithad ='Get" oct iancal
<input type"numbx
ploabalder Énty humhe
br Lh nome=nm2
<label odd, ion'Addetran
</labd
input
Substraction tye"koda
yalueSub
<in)ut type" rodio" wolueDiv"
mytphcotin
<inyut tynes rodig " uolue "mwt"
-"calcwate'"
<inpwt type"subrot" walue<" coleulate
<inpt tye =l eset" Volue"Rs"
<láorm
<lhody
cal jova
pockag caleulator
Sting
String apreguat qet Poromter
CCalclate)
dable numbwll 3 Dauble porseDoub
(numb )
L8 Copr' eqals ("Add")
3
Qut: Hntln (numbrl
-LhpourmSeJbaub)u
else i Copr equals sub'))
Outntln Coum besll
numhurn
println (num bell humhuria)
olse idCapr. ec uals(lti))
else
utpinto(numb nclnumbur
O4pin tlnEnted Tnaud
pintln"Entrd
coth(Excn tian e)
Qut println (Errar
Iode htmt
-ox
i5lununbr
Additlon
Diuls lon 0 mwtphcoton o
Colcuo
Cocote a selet
b] the Usrnomee
Sor ogin poge
then it_Soys essog
misso
prograr
in dex:htm
<\D0cPE HTML)
htm)
heod)<heod)
<bo dy
Kform ation =
action"lo4
<hl) Lagin farmn hl)
<input type "text
ploaho ldur userno!
"usernome" <bri
Kiput type : 'possword
plachader "posswor d"
home n0sS ward"br)L
<1&ormn)
<lbodys
lhtrol
podkog lagini
import j9va i0-*j
Smprt jovox Servut *j
Impart joyox SUrvut .http
publa doss log utunds HAtpS
proteed Vord AroeSsRequet do
HttpSuvutRquest
equest Httpser
Resane espanse)
+hrows StowletExeentLa TO£xce2ts
PrintHter out respane qetnit
tye
String unome eqaistqetPoromt.ex
(usurnom
Stving passard niquestqut Porory
ter ("possward")
Output
LoaN Form
dnine
as344ST d
totn
qCste a caístratiao soav let in íovo
Using TDBC. Accapt the detols
using
htmlfarm & stare the gstationd
deta ls ín deltabosc
Proqrom
) SQLconnection/uey
use dor-proctiols
>crea te tobe aqistrat'ao
uSrnome vorchar (30)
osswr
vorchor (3o))
count
iDdex htol
<LDoCTYDE HTmL)
<htm)>
2heod)< heod
<body
Lhl>2egstra tian Farm <Lhl>
Kform action=lrg methad''get"
<ipput t p e t u t
plocehaldes 'usemnme!
nom "usrnome ( leited
<hr) <br>
<Inpat typeposs M0rd"
p loceha des "Dosswrd
hame
<h <br
type ema"
pla aldta "emL
<br<br
<iDput Lypstet"
ploch ldur
chorsete "))
Pint\Nnte out =espn
ty
Sting wnomez equest gtloronmt
String posswd =quest gctarane
C"Possuord ")
e (Chnphintln aut
CExcaptlon
e) catch ?
dlly "succers insatcd
rouIosatd
exe pr jnt
cauntgl ysetsting
(4,
rcststrng
passwd sstung
(2 rr
(IuemeprestStr1ng
") walus Countng
rat into("insnt Statemnnt
por PrpoYdStatmnt
con: pe
"YOot1924r"
icols Idor- 0G
calhast
33 1/llo
(jdbcConneton
gtrgu
Cannton
con=
ot untyuest
get Sting
tr eroole
Sting
blc loss edame en tends HAApser
Out put:
Logn or m
Log
\NI'lcont jova
dor
admin
nurmber o£
to stothe
Useohosis tcd
They iodarnatiooe
client
multiple nomea
btwen hos_a
- H
cOolk ottribute Su
damu
acommentpatfh ý
as
Veaslon numbeo Considiod
equest
dedout eoch teehnin.
reduestTo eaokes
a new
eadd ctor
sevet So the caokeg s
the browseoAdtsr that I
cotche ad
Yq s Snd hy the USa Cooks isk
oddd hy gues t by dedat Th
2ecog nid theus eor s ald uw
Progrom
Jndex btml
<htm>
<heod hea
<body
<doxrn otion "Pag
ntr yaur Nare
<input tynetxt"
hame tenta
Linpt yncsuh m1t"
volue="dk ntey!
<dorm
</hhm|
Pagel java
2rintHteaut = esponseqtNriter
out pntlnc"shtml><h«od><tite
Pogalth <heod>):
Outrín Hh (1< bady hacolar =pnk y"
Stng nonez e questqt Poremete
(textNam
0 u t i n tro cl<h> Mecanc'tunoet
Cookiekez ne
esonss add Caalxie Cclk )
tespanseodd Casle Colel
("<ht <a heta Poc2)
utnniot o Poye 2 <lo </hJ
Clhck to ust
4ath("<lhody "
2untn("4|html, ")
3
Pog 2ovo
Pocko mypaki
n p t fovoX s r t
etnd
sHAtpSerlsi
pubhe closs poge)
overude doart CHAtpsruut
protected void
Regust equsstHEtpSavtRo
Hntln("<p Uscnore=t
getse
Outnatin C"bl) nelcorre,
&st time 3)tor
Cootie ('vst",);
esponst, addaskies (nwllsit Cookie);
owt_prntln (<p) usenom unknau
Gutpt:
chde to entr
ALelcamue AthorN
\7sIt No
Prgram
Ines htn
<Do cTYPE HTnL
<html
<hegcd>
<lhesd
<ba dy
<dormn actlOn 'Dag methad"gt"
Shput typ Eent
ne = t N a m < b r
<Iht rmn
Dogjdua
patog nyocki
danotjovoio*
Poase Lnt
bs qtAtta'bute, Cyist))H
outpintl (<h) vou ols kt d <lh"S
hsst AtA but. Cysi!
?
Outinln"Kh Your Sess190 ID
hs.qutTd ) "<|h ")
awkrntn <hlYau logscd inat"+
new jovowtl DoteChs get Creation
auty n tln (<hl <a hred= Pogel
Cliclefon pog <a> <|hS)
out pintn ("<hls <a hre logautSen ut
S CLclk
toTornoinate,
Sesslon <la
Ot pin t h (" <lba dy <lhtm )
GovrrLde
proteete d vard docet (Htp StautRequst
equest, Http SeryetRex2ongo ripans
throws
Rsponsest Content I4pe teat/htm
Paintu be out esponsc q t l iter
Out prinlacl<html>hedLts
Httpslun hs qucstqtSesS1an
Coalse
otpnntln (1<h welcome agoío on
Pog No.0<hls")
int visttotegta pdsTnt
hsqtA+tnbute Cly((Strn
OutpnthC"b) Vou Vsitedtysk
hs "Tme"h");
setAAtrbute ("
tpntln (" <h> VISLt",4vIs1t);
YourSessioo
+hs. gttd +" <bl) ) TO!
Ot ntln (^<his You
lagged(hsin at
t new Jouo.ut lDote
Creatian
OLtpnth c'" <hl Tim)+
<o "el) "))
hrd -Pol
Qutrintln (<hl <a hreda LogatSent
Session <
LogoutS
po cko
eryutiova
myoc
impart jovo io-*
mport ouX Seuk.s
impot pyo X Seavut
hthpti
closs Logaut Seuwt ex tends HHp
pro teedd old docrtCHLLpseeu et Requst
requs t HttpSavt Respanje riponsc)
Seav Excyptlào TOExptian
esponscsetCantnt Tune ("htrnl|teat
chorsteuI¾-8)
Outpntln ("<html> heod) <tt
Scayut Logaat Scat Jtitl
/ovoX Semwlet hthp HAp Sessidns
Out
UscxtDLALhoy-c
Pecetstmt
our SessonO s400 3 2054G92102id
3S2