8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
1/54
BCSL-057Web ProgrammingSession 1: Using Web 2.0 and creating pages using !"#L
$ns 1. !ere are t%e &eatures o& t%e 5 Web 2.0 tec%no'ogies:
(. )eatures o& *a+ascript:
1. Bro,ser support: $'' bro,sers %a+e accepted a+ascript as a
scripting 'anguage &or t%em and pro+ides integrated support &or
it. $'' ou need to do is to %and'e some o& t%e tas/s t%at are
dependent on # ocument bect #ode'3 o& di4erent
bro,sers proper'.
2. Used on c'ient side as ,e'' as on ser+er side: $s a+ascript %as
access to ocument obect mode' o& bro,ser ou can actua''c%ange t%e structure o& ,eb pages at runtime. ue to t%is
a+ascript can be used to add di4erent e4ects to ,ebpages. n
t%e ot%er %and a+ascript cou'd be used on t%e ser+er side as
,e''.
6. )unctiona' programming 'anguage: (n a+ascript &unction cou'd
be assigned to +ariab'es ust 'i/e an ot%er data tpes. ot on'
t%at but a &unction can accept anot%er &unction as a parameter
and can a'so return a &unction.
8. Support &or obects: *a+ascript is an obect oriented 'anguage.
!o,e+er t%e ,a a+ascript %and'es obects and in%eritance is
bit di4erent &rom con+entiona' obect oriented programming
'anguages 'i/e *a+a. ue to t%is a+ascript supports most o& t%e
obect oriented concepts ,%i'e being simp'e to 'earn and use.
((. )eatures o& !"#L5:
1. 9ideo e'ements: esigners can no, bui'd ,eb pages ,it%out%a+ing to resort to t%ird-part proprietar p'ug-in so&t,are 'i/e
)'as%. ou"ube is e;perimenting ,it% using !"#L 5 to disp'a
+ideo. Bui't in +ideo contro's ma/es t%e &eature more attracti+e
and eas to use.
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
2/54
BCSL-057Web Programming2. $pp'ication cac%e: n t%e 'ines o& ut'oo/ but minus t%e emai'
c'ient re=uirement ou can no, store ,eb apps muc% 'i/e emai's
'oca''. >oog'e %as a'read made use o& t%is &eature rep'acing its
>oog'e >ears mai' c'ient ,it% !"#L 5. >oog'e Wa+e a'so uses
!"#L 5.
6. Can+as &or (mages: "%e can+as e'ement t%at comes ,it% !"#L 5
'ets ou manipu'ate grap%ics and p%otos enab'ing eas rendering
o& images. esigners no 'onger need to use intermediate
tec%no'ogies 'i/e ?uer. "%is ,i'' %e'p sa+e de+e'opment time
and e4ort.
8. >eo'ocation: "%e !"#L5 >eo'ocation &eature enab'es 'ocation
identi@cation using +arious geo 'ocation tec%no'ogies >PS >'oba'Positioning sstem3 (P address A)( Aadio &re=uenc (3 Wi-
)i B'uetoot% #$C address and >S#C#$ ce'' (s. "%e sstem is
bound b pri+ac regu'ations and needs to be aut%ori
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
3/54
BCSL-057Web Programming6. (t is p'at&orm-independent t%us re'ati+e' immune to c%anges in
tec%no'og.
8. (t a''o,s +a'idation using sc%ema 'anguages suc% as S and
Sc%ematron ,%ic% ma/es e4ecti+e unit-testing @re,a''s
acceptance testing contractua' speci@cation and so&t,are
construction easier.
(9. )eatures o& *SP:
1. Scripting D'ements - *SP supports 6 tpes o& scripting e'ements:
dec'arations script'ets and e;pressions. Script'ets are most
common' used to enter an code &ragments in t%e de&au't *a+a
'anguage.
2. Bui't-in bects - *SP 2.1 supports a number o& bui't-in imp'icit
obects t%at pro+ide ou eas access to di4erent parts o& t%e
app'ication en+ironment.
6. *a+a Beans - *SP 2.1 supports *a+aBean obects using t%e
EuseBeanE action e'ement.
8. *S"L *SP Standard "ag Librar3 - *SP 2.1 supports *S"L core
'ibrar and custom tag 'ibraries.
9. )eatures o& $a;:
1. Aea'-"ime Updates: $s part o& t%e continuous &ee' $a;
app'ications can update t%e page in rea'-time. Current' ne,s
ser+ices on t%e ,eb redra, t%e entire page at inter+a's e.g.
once e+er 15 minutes. (n contrast itFs &easib'e &or a bro,ser
running an $a; app'ication to po'' t%e ser+er e+er &e, seconds
so itFs capab'e o& updating an in&ormation direct' on t%e partso& t%e page t%at need c%anging. "%e rest o& t%e page is
una4ected.
2. >rap%ica' (nteraction: $a; represents a transition into t%e ,or'd
o& >U( contro's +isib'e on present-da des/tops. "%us ou ,i''
encounter animations suc% as &ading te;t to te'' ou somet%ingFs
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
4/54
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
5/54
BCSL-057Web Programming
Hp%oneGnoM011-22K78811Hp%oneGnoM
HmobGnoMK722257HmobGnoM
HcustomerM
HcustomerM
HnameM#r. 9ipin OumarHnameM
HaddressM#aur 9i%arHaddressM
Hp%oneGnoM011-2257777Hp%oneGnoM
HmobGnoMK7K7K777HmobGnoM
HcustomerM
HcustomerM
HnameM#r. Oama'/antHnameM
HaddressM*ana/ PuriHaddressM
Hp%oneGnoM011-28655Hp%oneGnoM
HmobGnoM2222K7HmobGnoMHcustomerM
HcustomerG'istM
2. Create t%e " &or t%e customers ou created in prob'em 1.
$ns. 2 Customer.dtd
6. Create an #L document to t%at stores data as #L document
c%ec/s it using #L sc%ema and disp'as t%e in&ormation as s%o,nin t%e tab'e be'o,:
)ec ,rogr$mme $me o2
dens
$$)$se 3sems M/ 4$mes'
4i$5
/dv$nced 6&er$ing 3sem M.Tec' $ndee&
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
6/54
BCSL-057Web Programming
riso&'er
$lim
7e) ,rogr$mming / F$r'in
4$$n
$ns. 6 Student(n&o.;m'
HI;m' +ersionJE1.0E encodingJE(S-KK5-1EIM
HstudentGin&o ;m'ns:;siJE%ttp:,,,.,6.org2001#LSc%ema-
instanceE
;si:sc%emaLocationJEStudent(n&o.;sdEM
HstudentM
HsubectMatabase SstemsHsubectM
HprogrammeM#C$HprogrammeM
HnameMAames%HnameMHstudentM
HstudentM
HsubectMatabase SstemsHsubectM
HprogrammeM#C$HprogrammeM
HnameMAia
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
7/54
BCSL-057Web Programming
HnameM)ar%inHnameM
HstudentM
HstudentM
HsubectMWeb ProgrammingHsubectM
HprogrammeMBC$HprogrammeM
HnameMAaanHnameM
HstudentM
HstudentGin&oM
Student(n&o.;sd
HI;m' +ersionJE1.0EIM
H;s:sc%ema +ersionJE1.0E
;m'ns:;sJE%ttp:,,,.,6.org2001#LSc%emaE e'ement)orme&au'tJE=ua'i@edEM
H;s:e'ement nameJEstudentGin&oEM
H;s:comp'e;"peM
H;s:se=uenceM
H;s:e'ement nameJEsubectE tpeJE;s:stringEM
H;s:e'ement nameJEprogrammeE tpeJE;s:stringEM
H;s:e'ement nameJEnameE tpeJE;s:stringEM
H;s:se=uenceM
H;s:comp'e;"peM
H;s:e'ementM
H;s:sc%emaM
8. Create a database o& boo/s tit'es aut%ors ear o& pub'ication
pub'is%er name price and number o& copies purc%ased using #L.
"%e 'ist s%ou'd %a+e at 'east 10 boo/s and e+er boo/ must %a+e at'east one aut%or. Create t%e #L sc%ema &or t%is boo/s data.
$ns. 8 Boo/Gstore.;m'
HI;m' +ersionJE1.0E encodingJE(S-KK5-1EIM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
8/54
BCSL-057Web ProgrammingHboo/Gstore ;m'ns:;siJE%ttp:,,,.,6.org2001#LSc%ema-
instanceE
;si:sc%emaLocationJEboo/Gstore.;sdEM
Hboo/M
Htit'eM(ndia 2016Htit'eM
Haut%orM>o+ernment o& (ndiaHaut%orM
HpubGearM2016HpubGearM
Hpub'is%erMPub'ication i+isionHpub'is%erM
HpriceMAs. 810HpriceM
HnoGo&GcopiesM5HnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM"%e Casua' 9acancHtit'eMHaut%orM* O Ao,'ingHaut%orM
HpubGearM2012HpubGearM
Hpub'is%erMLitt'e Bro,n Boo/ >roupHpub'is%erM
HpriceMAs. K50HpriceM
HnoGo&GcopiesM8HnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM#idnig%tQs C%i'drenHtit'eM
Haut%orMSa'man Aus%dieHaut%orM
HpubGearM2012HpubGearM
Hpub'is%erM9intageHpub'is%erM
HpriceMAs. 8HpriceM
HnoGo&GcopiesM6HnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM(n&ernoHtit'eM
Haut%orMan Bro,nHaut%orM
HpubGearM2016HpubGearM
Hpub'is%erMAandom !ouseHpub'is%erMHpriceMAs. 750HpriceM
HnoGo&GcopiesMHnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eMWings o& )ireHtit'eM
Haut%orM$ P * $bdu' Oa'amHaut%orM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
9/54
BCSL-057Web ProgrammingHpubGearM2000HpubGearM
Hpub'is%erMUni+ersities PressHpub'is%erM
HpriceMAs. 275HpriceM
HnoGo&GcopiesM10HnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM"urning PointsHtit'eM
Haut%orM$ P * $bdu' Oa'amHaut%orM
HpubGearM2012HpubGearM
Hpub'is%erM!arper Co''insHpub'is%erM
HpriceMAs. 225HpriceM
HnoGo&GcopiesMKHnoGo&GcopiesM
Hboo/M
Hboo/MHtit'eMAe+o'ution 2020Htit'eM
Haut%orMC%etan B%agatHaut%orM
HpubGearM2011HpubGearM
Hpub'is%erMAupa R CoHpub'is%erM
HpriceMAs. 180HpriceM
HnoGo&GcopiesMHnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM2 StatesHtit'eM
Haut%orMC%etan B%agatHaut%orM
HpubGearM2012HpubGearM
Hpub'is%erMA A S%et% Co.Hpub'is%erM
HpriceMAs. 150HpriceM
HnoGo&GcopiesMHnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM(ndian DconomHtit'eM
Haut%orMAames% Sing%Haut%orM
HpubGearM2016HpubGearMHpub'is%erM#c>ra, !i'' DducationHpub'is%erM
HpriceMAs. 825HpriceM
HnoGo&GcopiesM5HnoGo&GcopiesM
Hboo/M
Hboo/M
Htit'eM$ Bend in "%e Ai+erHtit'eM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
10/54
BCSL-057Web ProgrammingHaut%orM9 S aipau'Haut%orM
HpubGearM2011HpubGearM
Hpub'is%erMPicadorHpub'is%erM
HpriceMAs. 6HpriceM
HnoGo&GcopiesM5HnoGo&GcopiesM
Hboo/M
Hboo/GstoreM
Boo/Gstore.;sd
HI;m' +ersionJE1.0EIM
H;s:sc%ema +ersionJE1.0E
;m'ns:;sJE%ttp:,,,.,6.org2001#LSc%emaE e'ement)orme&au'tJE=ua'i@edEM
H;s:e'ement nameJEboo/GstoreEM
H;s:comp'e;"peM
H;s:se=uenceM
H;s:e'ement nameJEtit'eE tpeJE;s:stringEM
H;s:e'ement nameJEaut%orE tpeJE;s:stringEM
H;s:e'ement nameJEpubGearE tpeJE;s:integerEM
H;s:e'ement nameJEpub'is%erE tpeJE;s:stringEM
H;s:e'ement nameJEpriceE tpeJE;s:integerEM
H;s:e'ement nameJEnoGo&GcopiesE tpeJE;s:integerEM
H;s:se=uenceM
H;s:comp'e;"peM
H;s:e'ementM
H;s:sc%emaM
Session 8 and 5: Using and ,riting *a+aScript in ,eb pages
1. Write a *a+aScript program t%at disp'as a rop o,n #enu.
$ns 1. HNC"PD %tm'M
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
11/54
BCSL-057Web ProgrammingH%tm'M
H%eadM Htit'eMHtit'eM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
HscriptM
&unction drop;3
i& document.&orm1.menu.+a'ue NJJ Enu''E3
document.'ocation.%re& J ;T
V
HscriptM
H%eadM
HbodMH&orm nameJE&orm1EM
Hse'ect nameJEmenuE
onC%angeJEdropdocument.&orm1.menu.options
document.&orm1.menu.options.se'ected(nde;X.+a'ue3TEM
HoptionMSe'ectHoptionM
Hoption +a'ueJ!per.%tm'M!"#LHoptionM
Hoption +a'ueJcss.%tm'MCSSHoptionM
Hoption +a'ueJs='.%tm'MS?LHoptionM
Hoption +a'ueJdb.%tm'MatabaseHoptionM
Hse'ectM
H&ormM
HbodM
H%tm'M
utput
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
12/54
BCSL-057Web Programming
2. Write a *a+aScript program t%at creates a se=uence o&
automatica'' c%anging pictures on a ,eb page.
$ns 2.
HNC"PD %tm'M
lides'o9
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
slides'o9im$ges#"BCim$ges #D*.&g"%"BCim$ges #*.&g"%"BCds.&g"%"BCim$ges
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
13/54
BCSL-057Web Programming#1*.&g"*
v$r slides'o9s&eed=1000
v$r 9'ic'im$ge=0
2ncion slidei#*
;
i2 #!docmen.im$ges*
rern
docmen.im$ges.slide.src=slideim$ges9'ic'im$ge.src
i2 #9'ic'im$ge
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
14/54
BCSL-057Web Programming Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
HscriptM
&unction get"imes3
+ar dtJne, ate3T
&orm1.t.+a'ueJ dt.get!ours3 Y E:E Y dt.get#inutes3 Y E:E Y
dt.getSeconds3T
,indo,.set"imeoutEget"imes3E00003T
V
HscriptM
H%eadM
Hbod onLoadJEget"imes3TEM
H&orm nameJE&orm1E met%odJEpostE actionJEEM Hinput nameJEtE tpeJEte;tE idJEtEM
H&ormM
HbodM
H%tm'M
5. Write a *a+aScript program t%at counts t%e number o& times a
Button is c'ic/ed.
$ns 5.
HNC"PD %tm'M
H%tm'M
H%eadM
Htit'eMHtit'eM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
HscriptM+ar counterT
counterJ0T
&unction count3
counterYYT
document.getD'ementB(dEaE3.inner!"#LJcounterT
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
15/54
BCSL-057Web Programming
V
HscriptM
H%eadM
HbodM
H&orm nameJE&orm1E actionJEE met%odJEpostEM
Hdi+ a'ignJEcenterEM
Hinput tpeJEbuttonE nameJEButtonE +a'ueJE!it #eE
onC'ic/JEcount3TEM
Hp idJEaEMHpM
Hdi+M
H&ormM
HbodM
H%tm'M
. Create a ,eb page ,it% t,o pictures. Write a *a+aScript program
t%at disp'as t%e description o& t%e picture ,%en mouse is broug%t
o+er t%e picture.
$ns .
HNC"PD %tm'M
H%tm'M
H%eadM Htit'eMHtit'eM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
HscriptM
&unction s%o,id3
document.getD'ementB(did3.st'e.+isibi'it J E+isib'eET
V
&unction %ideid1id23
document.getD'ementB(did13.st'e.+isibi'itJE%iddenETdocument.getD'ementB(did23.st'e.+isibi'itJE%iddenET
V
HscriptM
H%eadM
Hbod on'oadJE%ideFt;t1FFt;t2F3TEM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
16/54
BCSL-057Web ProgrammingHdi+ st'eJEbac/ground-image:ur'Fimages.pgF3T te;t-a'ign:centerT
%eig%t:250p;T ,idt%:1K0p;TE on#ouse+er J Es%o,Ft;t1F3TE
on#ouseutJE%ide
Ft;t1F3TEM
HbrMHbrM
Hp idJEt;t1E st'eJEco'or:e''o,T &ont-si
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
17/54
BCSL-057Web Programmingi&document.images3
+ar image1 J ne, (mage3T
image1.src J Eboo/s.pgET
+ar image2 J ne, (mage3T
image2.src J Eimages.pgET
V
HscriptM
H%eadM
HbodM
HpM#o+e our mouse o+er t%e image to see t%e resu'tHpM
Ha %re&JEZE on#ouse+erJEdocument.m(mage.srcJimage2.srcTE
on#ouseutJEdocument.m(mage.srcJimage1.srcTEM
Himg nameJEm(mageE srcJEimages.pgE MHaM
HbodM
H%tm'M
Session 7: Using *SPSer+'et
1. Write a *SPSer+'et program t%at ta/es our name and address
&rom an !"#L )orm and disp'as it on a ,eb page.
$ns 1. User(n&o.%tm'
HNC"PD %tm' [page content"peJEte;t%tm'E
pageDncodingJEU")-KEM
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eMUser (n&oHtit'eM
H%eadM Hbod M
H%1MUser (n&ormationH%1M
HcenterM
H%2MDnter etai'sH%2MHbrM
H&orm actionJE(n&o.spE met%odJEpostEM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
18/54
BCSL-057Web Programming HbrMUsername: Hinput tpeJEte;tE
nameJEusernameEMHbrM
HbrM$ddress: Hte;tarea
nameJEaddressEMHte;tareaMHbrMHbrM
HbrMHinput tpeJEsubmitE +a'ueJESubmitEM
H&ormM
HcenterM
HbodM
H%tm'M
(n&o.sp
HNC"PD %tm' [page content"peJEte;t%tm'E
pageDncodingJEU")-KEM
H%tm'M H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eMUser (n&oHtit'eM
H%eadM
HbodM
HbrMHbrMHbrMHbrMHbrM
HcenterMH%2M(n&ormation gi+en b User:H%2M
HbrMHbrM
H
String usernameJre=uest.getParameterEusernameE3T
session.set$ttributeEusernameEusername3T
String addressJre=uest.getParameterEaddressE3T
session.set$ttributeEaddressEaddress3T
String aJsession.get$ttributeEusernameE3.toString3T
out.print'nEHbMame: HbMEYa3T
String bJsession.get$ttributeEaddressE3.toString3T
out.print'nEHbrMHbrMHbM$ddress: HbMEYb3T
M HcenterM
HbodM
H%tm'M
utput:
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
19/54
BCSL-057Web Programming
2. Write a *SP program t%at output current time on'.
$ns 2. "ime.sp
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
HNC"PD %tm'M
H%tm'M
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
20/54
BCSL-057Web Programming H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eMCurrent "imeHtit'eM
H%eadM
HbodM
H
a+a.uti'.Ca'endar ca'endarJa+a.uti'.Ca'endar.get(nstance3T
int %ourJca'endar.getca'endar.!UA3T
int minJca'endar.getca'endar.#(U"D3T
int secJca'endar.getca'endar.SDC3T
out.print'nEHbMCurrent time:-HbM EY %ourYE : EYminY E :
EYsec3T
M HbodM
H%tm'M
utput:
6. Write a *SP program t%at counts t%e number o& times a 'in/ is
c'ic/ed.
$ns 6. Counter.sp
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
HNC"PD %tm'M
H%tm'M
H%eadMHtit'eMCounterHtit'eMH%eadM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
21/54
BCSL-057Web Programming HbodM
HN int c'ic/s J 0T M
H
String param J re=uest.getParameterEintegerE3T
tr
int i J (nteger.parse(ntparam3T
c'ic/s YYT
V
catc% umber)ormatD;ception e3
V
M
HpMumber o& c'ic/s: HJ c'ic/s M HpMH&orm actionJEEM
Hinput tpeJEte;tE nameJEintegerE +a'ueJE1EM
Hinput tpeJEsubmitE +a'ueJEsubmitE M
H&ormM
HbodM
H%tm'M
utput:
8. Create @+e pages o& a ,eb site %a+ing simi'ar top and 'e&t pane's.
"%e top s%ou'd %a+e a 'ogo on t%e 'e&t and name o& t%e organi
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
22/54
BCSL-057Web Programmingin t%e midd'e. "%e 'e&t s%ou'd %a+e a drop do,n menu. Use *SP to
inc'ude it in a'' t%e ,eb pages.
$ns 8. "op.sp
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM(>UHtit'eM
Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM H%eadM
HbodM
Hdi+ c'assJEtopEM
Htab'eMHtrMHtd c'assJEpicEMHtdM
HtdMH%1M(ndira >and%i ationa' pen Uni+ersitH%1M
H%6MAD>($L CD"AD DL!(-2HbrM>and%i Smriti R ars%an
Samiti Aag%at e, e'%i-110002 (($H%6MHtdMHtrM
Htab'eM
Hdi+M
HbodM
H%tm'M
Le&t.sp
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM Htit'eM(>UHtit'eM
Hscript M
&unction drop;3
i& document.&orm1.menu.+a'ue NJ Enu''E3
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
23/54
BCSL-057Web Programming document.'ocation.%re& J ;
V
V
HscriptM
Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM
H%eadM
HbodM
Hdi+ c'assJE'e&tEMHbrMHbrM
H&orm nameJE&orm1EM
Hse'ect nameJEmenuE
onC%angeJEdropdocument.&orm1.menu.optionsdocument.&orm1.menu.options.se'ected(nde;X.+a'ue3EM
Hoption +a'ueJ!ome.spM!omeHoptionM
Hoption +a'ueJD+ents.spMD+entsHoptionM
Hoption +a'ueJStuGSupport.spMStudent SupportHoptionM
Hoption +a'ueJe+GPro@'e.spMe+e'oper Pro@'eHoptionM
Hoption +a'ueJ)eedbac/.spM)eedbac/HoptionM
Hse'ectM
H&ormM
Hdi+M
HbodM
H%tm'M
!ome.sp
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM(>UHtit'eM Hscript M
&unction drop;3
i& document.&orm1.menu.+a'ue NJ Enu''E3
document.'ocation.%re& J ;
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
24/54
BCSL-057Web Programming V
V
HscriptM
Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM
H%eadM
HbodM
Hdi+ c'assJE'e&tEMHbrMHbrM
H&orm nameJE&orm1EM
Hse'ect nameJEmenuE
onC%angeJEdropdocument.&orm1.menu.optionsdocument.&orm1.m
enu.options.se'ected(nde;X.+a'ue3EM Hoption +a'ueJ!ome.spM!omeHoptionM
Hoption +a'ueJD+ents.spMD+entsHoptionM
Hoption +a'ueJStuGSupport.spMStudent SupportHoptionM
Hoption +a'ueJe+GPro@'e.spMe+e'oper Pro@'eHoptionM
Hoption +a'ueJ)eedbac/.spM)eedbac/HoptionM
Hse'ectM
H&ormM
Hdi+M
HbodM
H%tm'M
D+ents.sp
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJut&-KEM
Htit'eMStud Centre WebsiteHtit'eM
Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM
H%eadM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
25/54
BCSL-057Web Programming
HbodM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ E"op.spEM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ ELe&t.spEM
Hdi+ c'assJEcontentEM
Hdi+ c'assJEcontentEMHbrMHbrMHbrMHbrM
Htab'e c'assJEe+eEMHtr c'assJEscEMHt% c'assJEe+eE
co'spanJE8EMD+ents etai'sHt%MHtrM
HtrMHt% c'assJEe+eEMS. o.Ht%M
Ht% c'assJEe+eEMD+entsHt%M
Ht% c'assJEe+eEMateHt%M
Ht% c'assJEe+eEM"imeHt%MHtrM HtrMHtdM1.HtdM
HtdMC'assica' #usic Aecita' HtdM
HtdM2 September 2016HtdM
HtdM10:00 $#HtdM
HtrM
Htr c'assJEa'tEMHtdM2.HtdM
HtdM)oundation a Ce'ebrationHtdM
HtdM20 ctober 2016HtdM
HtdM0:00 $#HtdM
HtrM
HtrMHtdM6.HtdM
HtdMC%i'drenFs a Ce'ebrationHtdM
HtdM18 o+ember 2016HtdM
HtdM11:00 $#HtdM
HtrM
Htr c'assJEa'tEMHtdM8.HtdM
HtdMebate CompetitionHtdM
HtdM10 ecember 2018HtdM
HtdM12:60 P#HtdM HtrM
Htab'eM
Hdi+M
Hdi+M
Hdi+MHdi+MHbodMH%tm'M
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
26/54
BCSL-057Web ProgrammingStuGSupport.sp
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJut&-KEM
Htit'eMStud Centre WebsiteHtit'eM
Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM
H%eadM
HbodM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ E"op.spEM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ ELe&t.spEM
Hdi+ c'assJEcontentEM
Ha %re&JEZEM$ttendanceHaMHbrM
Ha %re&JEZEMate S%eetHaMHbrM
Ha %re&JEZEMAesu'tHaMHbrM Ha %re&JEZEM>rade CardHaMHbrM
Ha %re&JEZEMPre+ious ear ?uestion PapersHaMHbrM
Ha %re&JEZEM$ssignmentsHaMHbrM
Hdi+M
Hdi+MHdi+MHbodMH%tm'M
e+GPro@'e.sp
HNC"PD %tm'M
H%tm'M H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJut&-KEM
Htit'eMStud Centre WebsiteHtit'eM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
27/54
BCSL-057Web Programming Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM
H%eadM
HbodM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ E"op.spEM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ ELe&t.spEM
Hdi+ c'assJEcontentEM
H%6 c'assJEcenEMe+e'oper Pro@'eH%6M
Hdi+ c'assJEcenEMHimg srcJEpic.pgE ,idt%JE600E%eig%tJE200EMHbrMSoni ubeHdi+MHbrM
Htab'e c'assJEe+eEMHtr c'assJEscEMHt% c'assJEe+eE
co'spanJE5EM$cademic ?ua'i@cationHt%MHtrM
HtrMHt% c'assJEe+eEMS. o.Ht%M
Ht%M?ua'i@cationHt%M
Ht%MBoardHt%M
Ht%M#ar/s Ht%M
Ht%MearHt%MHtrM
HtrMHtdM1.HtdM
Htd M10t%HtdM
HtdMCBSDHtdM
HtdM72.2HtdM
HtdM200KHtdMHtrM
Htr c'assJEa'tEMHtdM2.HtdM
HtdM12t%HtdM
HtdMCBSDHtdM
HtdM71.55HtdM
HtdM2010HtdMHtrM
Htab'eMHbrMHbrM Htab'e c'assJEe+eEMHtr c'assJEscEMHt%
co'spanJE2EMProects etai'Ht%MHtrM
HtrMHt% c'assJEe+eEMS. o.Ht%M
Ht% c'assJEe+eEMProect ameHt%MHtrM
HtrMHtdM1.HtdM
HtdM#a/e#ea'.comHtdMHtrM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
28/54
BCSL-057Web Programming Htr c'assJEa'tEMHtdM2.HtdM
HtdMBoo/#"rip.comHtdMHtrM
HtrMHtdM6.HtdM
HtdM#(ndia.comHtdMHtrM
Htab'eM
Hu'MH'iM!obbies: RnbspTRnbspTRnbspTRnbspTAeading
boo/s R sur@ng netH'iM
H'iM(nterests: RnbspTRnbspTListening to music R 'earning
ne, t%ingsH'iMHu'M
Hdi+M
Hdi+MHdi+MHbodMH%tm'M
)eedbac/.sp
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJut&-KEM
Htit'eMStud Centre WebsiteHtit'eM
HscriptM
&unction +eri&3
i& document.&orm1.name.+a'ue JJJ EE3
a'ertEP'ease Dnter our ameE3T
document.&orm1.name.&ocus3T
return &a'seT
V
i& document.&orm1.enro'.+a'ue JJJ EE3
a'ertEP'ease enter our Dnro''ment o.E3T
document.&orm1.enro'.&ocus3T return &a'seT
V
i& document.&orm1.emai'.+a'ue JJJ EE3
a'ertEP'ease gi+e t%e Dmai' (E3T
return &a'seT
V
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
29/54
BCSL-057Web Programming
i& document.&orm1.comment.+a'ue JJJ EE3
a'ertEP'ease ,rite our comments.E3T
document.&orm1.comment.&ocus3T
return &a'seT
V
return trueT
VHscriptM
Hst'e tpeJEte;tcssEM
[import ur'E(>UCSS.cssE3T
Hst'eM
H%eadM
HbodM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ E"op.spEM
Hdi+ c'assJEcontainerEM
H[inc'ude @'eJ ELe&t.spEM
Hdi+ c'assJEcontentEM
HbrMHbrMHbrMHbrM
H&orm actionJEE nameJE&orm1EM
H@e'dset c'assJEe+eEMH'egend c'assJEe+e1EM)eedbac/
)ormH'egendM HbrMHbrMame: Hinput c'assJErig%tE tpeJEte;tE
nameJEnameEM
HbrMHbrMDnro''ment o. )i''ed in b t%e students
o& (>U
on'3:Hinput c'assJErig%tE tpeJEte;tE nameJEenro'EM
HbrMHbrMDmai' (:Hinput c'assJErig%tE tpeJEte;tE
nameJEemai'EM
HbrMHbrMWrite our comments %ere:
HbrMHte;tarea c'assJErig%tEro,sJE5E co'sJE60E nameJEcommentEMHte;tareaM
HbrMHbrMHbrMHbrMHbrM
Hinput tpeJEsubmitE +a'ueJESubmitE onC'ic/JEreturn
+eri&33TEM
H@e'dsetM
H&ormM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
30/54
BCSL-057Web Programming Hdi+M
Hdi+MHdi+MHbodMH%tm'M
(>UCSS.css
bodco'or:Z000T &ont-si
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
31/54
BCSL-057Web Programming
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
32/54
BCSL-057Web Programming
5. Create a 'ogin &orm and c%ec/ i& t%e user name and pass,ord
entered b t%e user are correct.
$ns 5.
Login)orm.%tm'
HNC"PD %tm' [page content"peJEte;t%tm'E
pageDncodingJEU")-KEM
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM*SP PageHtit'eM H%eadM
Hbod M
H%1MLogin PageH%1M
HcenterM
H%2MSignup etai'sH%2M
H&orm actionJELoginC%ec/.spTE met%odJEpostEM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
33/54
BCSL-057Web Programming HbrMUsername:Hinput tpeJEte;tE nameJEusernameEM
HbrMPass,ord:Hinput tpeJEpass,ordE nameJEpass,ordEM
HbrMHinput tpeJEsubmitE +a'ueJESubmitEM
H&ormM
HcenterM
HbodM
H%tm'M
LoginC%ec/.sp
HNC"PD %tm' [page content"peJEte;t%tm'E
pageDncodingJEU")-KEM
H%tm'M
H%eadM Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM*SP PageHtit'eM
H%eadM
HbodM
H
String usernameJre=uest.getParameterEusernameE3T
String pass,ordJre=uest.getParameterEpass,ordE3T
i&username.e=ua'sEabcdE3 RR pass,ord.e=ua'sE;
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
34/54
BCSL-057Web ProgrammingH%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM*SP PageHtit'eM
H%eadM
HbodM
HbrMHbrMHbrMHbrMHbrM
HcenterM
H%2M
H
String aJsession.get$ttributeEusernameE3.toString3T
out.print'nE!e''o EYa3T
M H%2M
HbrM
HbrM
HbrMHbrMHbrMHbrMHbrM
Ha %re&JELogout.spEMLogoutHaM
HcenterM
HbodM
H%tm'M
Logout.sp
HNC"PD %tm' [page content"peJEte;t%tm'E
pageDncodingJEU")-KEM
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM*SP PageHtit'eM H%eadM
HbodM
H
session.remo+e$ttributeEusernameE3T
session.remo+e$ttributeEpass,ordE3T
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
35/54
BCSL-057Web Programming session.in+a'idate3T
M
H%1MLogout ,as done success&u''.H%1M
HbodM
H%tm'M
Drror.sp
HNC"PD %tm' [page content"peJEte;t%tm'E
pageDncodingJEU")-KEM
H%tm'M
H%eadM Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM*SP PageHtit'eM
H%eadM
HbodM
H%1MSome Drror %as occurred P'ease tr again 'ater...H%1M
HbodM
H%tm'M
utput:
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
36/54
BCSL-057Web Programming
. Create a =ui< o& at 'east @+e =uestions and c%ec/ i& t%e =uestions
%a+e been ans,ered correct'.
$ns .
?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
37/54
BCSL-057Web Programming
i& m&orm.grpiXcounterX.c%ec/ed3
radioGc%oice J trueT
V
i& NradioGc%oice3
a'ertEP'ease se'ect one.E3T
return &a'se3T
V
returntrue3T
V
V
HscriptM
H%eadM HbodM
H%1M?uii+e t%e ans,er o& t%e &o''o,ing =uestions b se'ecting
one option &or eac%:HbM
HbrMHbrM
?1.W%ic% one o& t%e &o''o,ing is t%e Capita' o& (ndiaIHbrMHbrM
H&orm actionJE?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
38/54
BCSL-057Web Programming Hinput tpeJEradioE nameJEgrp2E +a'ueJE$utomated
"raining #ac%ineE M$utomated "raining #ac%ineHbrM
Hinput tpeJEradioE nameJEgrp2E +a'ueJE$utomated
"e''er #ac%ineE M$utomated "e''er #ac%ineHbrM
Hinput tpeJEsubmitE +a'ueJESubmitEM
H&ormMHbrM
?6.W%o is t%e @rst #ug%a' Dmperor o& (ndiaIHbrMHbrM
H&orm actionJE?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
39/54
BCSL-057Web Programming Hinput tpeJEradioE nameJEgrp5E +a'ueJE* O Ao,'ingE M* O
Ao,'ingHbrM
Hinput tpeJEradioE nameJEgrp5E +a'ueJEC%etan
B%agatE MC%etan B%agatHbrM
Hinput tpeJEradioE nameJEgrp5E +a'ueJE*%umpa La%iriE
M*%umpa La%iriHbrM
Hinput tpeJEsubmitE +a'ueJESubmitEM
H&ormM
HbodM
H%tm'M
?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
40/54
BCSL-057Web Programming?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
41/54
BCSL-057Web Programming HbodM
H
String ans,erJEBabarET
String s1Jre=uest.getParameterEgrp6E3T
i&s1.e=ua'sans,er33
out.print'nEH%8Mour $ns,er is correctNH%8ME3T
V
e'se
out.print'nEH%8MWrong $ns,erN HbrMHbrMCorrect
$ns,er is : H%8MEYans,er3T
V
MHbrMHbrM
Ha %re&JE?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
42/54
BCSL-057Web Programming out.print'nEH%8MWrong $ns,erN HbrMHbrMCorrect
$ns,er is :H%8MEYans,er3T
V
MHbrMHbrM
Ha %re&JE?ui
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
43/54
BCSL-057Web Programmingutput:
7. Write a *SP program t%at disp'as ^>ood #orning_ or ^>ood
D+ening_ based on t%e present time.
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
44/54
BCSL-057Web Programming
$ns 7. >reeting.sp
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
HNC"PD %tm'M
H%tm'M
H%eadM
Hmeta %ttp-e=ui+JEContent-"peE contentJEte;t%tm'T
c%arsetJU")-KEM
Htit'eM>reetingHtit'eM
H%eadM
HbodM
HbM "odas ate R "ime is :HbM
H a+a.uti'.ate date J ne, a+a.uti'.ate3T
out.print'nE EYdate3T a+a.uti'.Ca'endar ca'endarJa+a.uti'.Ca'endar.get(nstance3T
int %ourJca'endar.getca'endar.!UAG)G$3T
i&%ourH123
M
!our isHbrM
HJ%ourM
H%6M>ood #orningNH%6M
HVe'se i&%ourMJ12 RR %ourH173M
H%6M>ood $&ternoonNH%6M
HVe'seM
H%6M>ood D+eningNH%6M
HVM
HbodM
H%tm'M
utput:
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
45/54
BCSL-057Web Programming
Session K 10: Writing simp'e app'ications using *SP and *BCand dep'oing it on ,eb or mobi'e de+ices
1. Create a ,ebsite using *SP and *BC t%at creates emp'oee
database o& an organi
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
46/54
BCSL-057Web Programming(ndira >and%i ationa' pen Uni+ersit
Hdi+M
Hdi+ c'assJE'e&tEM
HmenuM
H'iMHa %re&JEDmp'oee.%tm'EM!omeHaMH'iM
H'iMHa %re&JEDmp'oee(n&o)orm.spEMDmp'oee
(n&ormationHaMH'iM
H'iMHa %re&JEepartment(n&o.spEMDmp'oees o&
epartmentHaMH'iM
HmenuM
Hdi+M
Hdi+ c'assJEcontentEM
H%6MWe'come to (>UH%6M
Hdi+MHdi+M
Hdi+ c'assJE&ooterEM
H&ooterM
H%rMRcopT 2016 SC(S (>U.
H&ooterM
Hdi+M
HbodM
H%tm'M
Dmp'oee(n&o)orm.sp
H[tag'ib pre@;JEcE uriJE%ttp:a+a.sun.comspst'coreEM
H[tag'ib pre@;JEs='E uriJE%ttp:a+a.sun.comspst's='EM
Hs=':setataSource +arJEms='E dri+erJEcom.ms='.dbc.ri+erE
ur'JEdbc:ms=':'oca'%ostms='E
userJEnetbeanE pass,ordJEnetbean7EM
Hs=':=uer dataSourceJEms='VE +arJEeptEM
SDLDC" epartment epGame &rom epartmentT
Hs=':=uerMH[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
H&orm nameJE(nputDmp'oeeataE actionJEDmp'oeeata(nput.spE
met%odJEPS"EM
Htab'e borderJE0EM
Ht%eadM
HtrM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
47/54
BCSL-057Web ProgrammingHt%MLabe'Ht%M
Ht%M(n&ormationHt%M
HtrM
Ht%eadM
HtbodM
HtrM
HtdMDmp'oee ( :HtdM
HtdMHinput tpeJEte;tE nameJEDmp'oee(E +a'ueJEE si
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
48/54
BCSL-057Web Programming HtrM
HtrM
HtdMSa'ar :HtdM
HtdMHinput tpeJEte;tE nameJESa'arE +a'ueJEE si
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
49/54
BCSL-057Web ProgrammingHs=':param +a'ueJEparam.*oiningGearVE M
Hs=':updateM
Hs=':=uer +arJEemp'oeemasterE dataSourceJEms='VEM
SDLDC" )A# ms='master W!DAD emp( J I Hs=':param
+a'ueJEparam.Dmp'oee(VE MT
Hs=':=uerM
"%e Aecord Dntered b ou is:
Htab'e borderJE1EM
HN-- co'umn %eaders --M
HtrM
Ht%MDmp'oee (Ht%M
Ht%MDmp'oee ameHt%M
Ht%MepartmentHt%M
Ht%MesignationHt%MHt%MSa'arHt%M
Ht%MDmai' (Ht%M
Ht%Mear o& *oiningHt%M
HtrM
HN-- co'umn data --M
Hc:&orDac% +arJEro,E itemsJEms='master.ro,sB(nde;VEM
HtrM
Hc:&orDac% +arJEco'umnE itemsJEro,VEM
HtdMHc:out +a'ueJEco'umnVEMHtdM
Hc:&orDac%M
HtrM
Hc:&orDac%M
Htab'eM
Dmp'oeeB ataBase
create database Dmp'oeeT
create user FnetbeanF[F'oca'%ostFidenti@ed bFnetbean7FT
grant a'' on Dmp'oee. to FnetbeanF[F'oca'%ostFT
create tab'e Dmp'oee emp( c%ar53 PA(#$A OD empame
+arc%ar803 " ULL epartment +arc%ar803 " ULL
esignation +arc%ar803 " ULL Sa'ar c%arK3 " ULL
Dmai'( +arc%ar803 " ULL *oiningGear c%ar83 " ULL3T
create tab'e epartment epartment +arc%ar803 PA(#$A OD
epGame +arc%ar803 " ULL #anager +arc%ar803 " ULL3T
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
50/54
BCSL-057Web Programming
insert into epartment 9$LUDSE#anagementE Eepartment o&
#anagementE E#r. $run OumarE3T
insert into epartment 9$LUDSE$ccountE Eepartment o&
$ccountingE E#r. 9ia #a'%otraE3T
insert into epartment 9$LUDSE!uman AesoursesE Eepartment o&
!uman AesourcesE E#s. Saro O%uranaE3T
se'ect &rom epartmentT
2. Create an app'ication t%at creates a simp'e ban/ing database
,it% tab'es &or customers and customer transactions. ou must
create a 'ogin &orm to +eri& 'ogin detai's &rom t%e customer tab'e.
ou ma create a session or use coo/ies i& possib'e to per&orm t%etransactions.
$ns 2. Customer.%tm'
HNC"PD %tm'M
H%tm'M
H%eadM
H'in/ tpeJEte;tcssE re'JEst'es%eetE %re&JECSSLaout.cssE M
H%eadM
HbodM
Hdi+ c'assJEcontainerEMHdi+ c'assJE%eaderEM
Punab ationa' Ban/
Hdi+M
Hdi+ c'assJE'e&tEM
HmenuM
H'iMHa %re&JECusotmer.%tm'EM!omeHaMH'iM
H'iMHa %re&JECustomer(n&o)orm.spEMCustomer
(n&ormationHaMH'iM
HmenuMHdi+M
Hdi+ c'assJEcontentEM
H%6MWe'come to Punab ationa' Ban/H%6M
Hdi+M
Hdi+M
Hdi+ c'assJE&ooterEM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
51/54
BCSL-057Web ProgrammingH&ooterM
H%rMRcopT 2016 PB$'' Aig%t Aeser+ed.
H&ooterM
Hdi+M
HbodM
H%tm'M
Customer(n&o)orm.sp
H[tag'ib pre@;JEcE uriJE%ttp:a+a.sun.comspst'coreEM
H[tag'ib pre@;JEs='E uriJE%ttp:a+a.sun.comspst's='EM
Hs=':setataSource +arJEms='E dri+erJEcom.ms='.dbc.ri+erE
ur'JEdbc:ms=':'oca'%ostms='E
userJEnetbeanE pass,ordJEnetbean7EMHs=':=uer dataSourceJEms='VE +arJEeptEM
SDLDC" epartment epGame &rom epartmentT
Hs=':=uerM
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
H&orm nameJE(nputCustomerataE actionJECustomerata(nput.spE
met%odJEPS"EM
Htab'e borderJE0EM
Ht%eadM
HtrM
Ht%MLabe'Ht%M
Ht%M(n&ormationHt%M
HtrM
Ht%eadM
HtbodM
HtrM
HtdMCustomer ( :HtdM
HtdMHinput tpeJEte;tE nameJECustomer(E +a'ueJEE si
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
52/54
BCSL-057Web ProgrammingHtdM Se'ect "ransaction:HtdM
HtdM
Hse'ect nameJE"ransEM
Hc:&orDac% +arJEro,E itemsJEept.ro,sVEM
Hoption +a'ueJEHc:out +a'ueJEro,."ransactionVEMEM
Hc:out +a'ueJEro,."GameVEM
HoptionM
Hc:&orDac%M
Hse'ectM
Hs=':=uer +arJE"ransactionE dataSourceJEms='3EM
SDLDC" "ransaction "Game )A# "ransaction
Hs=':=uerM
Hc:&orDac% +arJEro,E itemsJE"ransaction.ro,sB(nde;VEM
Hc:&orDac% +arJEco'umnE itemsJEro,VEM
HtdMHc:out +a'ueJEco'umnVEM
Hc:&orDac%M
Hc:&orDac%M
HtdM
HtrM
HtdM $ccount umber :HtdM
HtdMHinput tpeJEte;tE nameJE$ccount umberE +a'ueJEE
si
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
53/54
BCSL-057Web Programming
Dmp'oeeata(nput.sp
H[ tag'ib uriJE%ttp:a+a.sun.comspst'coreE pre@;JEcEM
H[ tag'ib uriJE%ttp:a+a.sun.comspst's='E pre@;JEs='EM
Hs=':setataSource +arJEms='E dri+erJEcom.ms='.dbc.ri+erE
ur'JEdbc:ms=':'oca'%ostms='E
userJEnetbeanE pass,ordJEnetbean7EM
H[page content"peJEte;t%tm'E pageDncodingJEU")-KEM
Hs=':update +arJEinsertE dataSourceJEms='VEM
(SDA" (" ms='master Customer( Customerame
"ransaction $ccountumber Dmai'( peningGear3
9$LUDSIIIIIII3T
Hs=':param +a'ueJEparam. Customer( VE M
Hs=':param +a'ueJEparam. Customerame VE MHs=':param +a'ueJEparam. "ransaction VE M
Hs=':param +a'ueJEparam. $ccountumber VE M
Hs=':param +a'ueJEparam.Dmai'(VE M
Hs=':param +a'ueJEparam. peningGear VE M
Hs=':updateM
Hs=':=uer +arJEcusotmermasterE dataSourceJEms='VEM
SDLDC" )A# ms='master W!DAD Customer( J I Hs=':param
+a'ueJEparam. Customer( VE MT
Hs=':=uerM
"%e Aecord Dntered b ou is:
Htab'e borderJE1EM
HN-- co'umn %eaders --M
HtrM
Ht%M Customer( Ht%M
Ht%M Customer ameHt%M
Ht%M "ransaction Ht%M
Ht%M $ccountumber Ht%M
Ht%MDmai' (Ht%M
Ht%M peningGear Ht%MHtrM
HN-- co'umn data --M
Hc:&orDac% +arJEro,E itemsJEms='master.ro,sB(nde;VEM
HtrM
Hc:&orDac% +arJEco'umnE itemsJEro,VEM
HtdMHc:out +a'ueJEco'umnVEMHtdM
B te
8/17/2019 BCSL-057 Lab Manual Solution_1442837699280
54/54
BCSL-057Web ProgrammingHc:&orDac%M
HtrM
Hc:&orDac%M
Htab'eM