Wt Record With Outputs

Embed Size (px)

Citation preview

  • 8/12/2019 Wt Record With Outputs

    1/61

    WEB TECHNOLOGIES LAB MANUAL

    WEEK 1& 2

    Aim:

    A HTML Program to Implement the Home Page That contains threeframes.i Top frame contains Logo an! the college "ame an! Lin#s to Home page$Login Page$ %egistration Page$ atalog'e page an! art Page.ii Left (rame contains At fo'r Lin#s for "a)igation.iii %ig#t frame contains The pages to Lin# in the left frame m'st *e loa!e!.

    P%+,%AM:

    in!e-.htmlhtml/hea!/title/0HA%AT I"TITTI+"3title/3hea!/frameset cols45167$85 ro9s452$;7$85/frame name45logo5 scrolling45no5 noresi

  • 8/12/2019 Wt Record With Outputs

    2/61

    logo.html

    h align45center5/img src4Bimages3 logo.gifB/3h/

    left.html

    center/a href45E.html5 st=le45te-t?!ecoration:none@5target45*o!=5/*/E3*/3a/*r/*r/*r/*r/a href45EE.html5 st=le45te-t?!ecoration:none@5target45*o!=5/*/EE3*/3a/*r/*r/*r/*r/a href45IT.html5 st=le45te-t?!ecoration:none@5

    tmen'.html

    ta*le align45center5/t! 9i!th451675 align45left5/a st=le45te-t?!ecoration:none@5 href45login.html5target45*o!=5/*/Login3*/3a/3t!/t! 9i!th451675 align45center5/a st=le45te-t?!ecoration:none@5href45%egistration.html5 target45*o!=5/*/%egistration3*/3a/3t!/t! 9i!th451675 align45center5/a st=le45te-t?!ecoration:none@5href45catalog'e.html5 target45*o!=5/*/atalog'e3*/3a/3t!/t! 9i!th451675 align45right5/a st=le45te-t?!ecoration:none@5 href45cart.html5

    target45*o!=5/*/art3*/3a/3t!/t!/3ta*le/

    *o!=.htmlh align45center5/Welcome to 0ITW3h/

    E.html

    h align45center5/+MPTE% IE"E E",I"EE%I",3h/

  • 8/12/2019 Wt Record With Outputs

    3/61

    ECE.htmlh align45center5/Electronics & omm'nication Engineering3h/

    IT.html

    h align45center5/I"(+%MATI+" TEH"+L+,C3h/

    login.html

    html/hea!/title/L+,I"3title/script t=pe45te-t3Da)ascript5/f'nction )ali!ate

    Fif!oc'ment.getElement0=I!Gi!G.)al'e.length447F9in!o9.alert5I is re>'ire!5@Jelseif!oc'ment.getElement0=I!GpassG.)al'e.length447F9in!o9.alert5Pass9or! is re>'ire!5@JelseF)ar name4!oc'ment.getElement0=I!Gi!G@9in!o9.alert5Welcome 5name.)al'e@JJ3script/3hea!/*o!=/h; align45center5/L+,I"3h;/ta*le align45center5/

    form metho!45post5/

  • 8/12/2019 Wt Record With Outputs

    4/61

    tr/t!/ser I:3t!/t!/inp't t=pe45te-t5 name45i!5 i!45i!5 3/3t!/3tr/tr/t!/Pass9or!:3t!/t!/inp't t=pe45pass9or!5 name45pass5 i!45pass5 3/3t!/3tr/tr/t! colspan4525 align45center5/inp't )al'e45Login5 t=pe45s'*mit5onclic#45)ali!ate@5 3/3t!/3tr/3ta*le/3*o!=/3html/

    Registration.html

    html/hea!/title/%egistration3title/script t=pe45te-t3Da)ascript5/f'nction )ali!ateF9in!o9.alert5%egistration 'ccess5@J3script/3hea!/

    *o!=/h; align45center5/%egistration3h;/form metho!45post5 action45login.html5/ta*le align45center5 height45;675/tr/t!/"ame:3t!/t!/inp't t=pe45te-t5 name45name5 3/3t!/3tr/tr/

    t!/Pass9or!:3t!/t!/inp't t=pe45pass9or!5 name45pass5 3/3t!/3tr/tr/t!/E?mail I:3t!/t!/inp't t=pe45te-t5 name45email5 3/3t!/3tr/

  • 8/12/2019 Wt Record With Outputs

    5/61

    tr/t!/Phone n'm*er:3t!/t!/inp't t=pe45te-t5 name45phno5 3/3t!/3tr/tr/t!/e-:3t!/t!/inp't t=pe45ra!io5 name45se-5 )al'e45male5 3/ Maleinp't t=pe45ra!io5 name45se-5 )al'e45female5 3/ (emale3t!/3tr/tr/t!/ate of 0irth M C:3t!/t!/select/ option )al'e4515 name45!5/13option/ option )al'e4525name45!5/23option/ option )al'e455 name45!5/3option/ option )al'e45;5

    name45!5/;3option/ option )al'e4565 name45!5/63option/ option )al'e455name45!5/3option/ option )al'e45N5 name45!5/N3option/ option )al'e45O5name45!5/O3option/ option )al'e455 name45!5/3option/ option )al'e45175name45!5/173option/ option )al'e45125 name45!5/123option/ option )al'e4515name45!5/13option/

    option )al'e451;5 name45!5/1;3option/ option )al'e45165name45!5/163option/ option )al'e4515 name45!5/13option/ option )al'e451N5name45!5/1N3option/ option )al'e451O5 name45!5/1O3option/ option )al'e4515name45!5/13option/ option )al'e45275 name45!5/273option/ option )al'e45215name45!5/213option/ option )al'e45225 name45!5/223option/ option )al'e4525

    name45!5/23option/ option )al'e452;5 name45!5/2;3option/ option )al'e45265name45!5/263option/ option )al'e4525 name45!5/23option/ option )al'e452N5name45!5/2N3option/ option )al'e452O5 name45!5/2O3option/ option )al'e4525name45!5/23option/

  • 8/12/2019 Wt Record With Outputs

    6/61

    option )al'e4575 name45!5/73option/ option )al'e4515name45!5/13option/3select/select/option )al'e4515 name45m5/13option/ option )al'e4525name45m5/23option/option )al'e455 name45m5/3option/ option )al'e45;5name45m5/;3option/option )al'e4565 name45m5/63option/ option )al'e455name45m5/3option/option )al'e45N5 name45m5/N3option/ option )al'e45O5name45m5/O3option/option )al'e455 name45m5/3option/ option )al'e45175name45m5/173option/option )al'e45115 name45m5/113option/ option )al'e45125name45m5/123option/

    3select/select/option )al'e451OO5 name45=5/1OO3option/ option )al'e451O5name45=5/1O3option/option )al'e45175 name45=5/173option/ option )al'e45115name45=5/113option/option )al'e45125 name45=5/123option/ option )al'e4515name45=5/13option/3select/

    3t!/3tr/tr/t!/Lang'ages Kno9n:3t!/t!/inp't t=pe45chec#*o-5 name45english5 )al'e45english5 3/ Englishinp't t=pe45chec#*o-5 name45tel'g'5 )al'e45tel'g'5 3/ Tel'g'inp't t=pe45chec#*o-5 name45hin!i5 )al'e45tel'g'5 3/ Hin!iinp't t=pe45chec#*o-5 name45tamil5 )al'e45tamil5 3/ Tamil

    3t!/3tr/tr/t!/A!!ress:3t!/t!/te-tarea ro9s45;5 cols4575 name45a!!ress5/3te-tarea/ 3t!/3tr/

  • 8/12/2019 Wt Record With Outputs

    7/61

    tr/t! colspan4525 align45center5/inp't )al'e45%egister5 t=pe45s'*mit5

    onclic#45)ali!ate@5 3/3t!/3tr/3ta*le/3*o!=/3html/

    cataloge.html

    script t=pe45te-t3Da)ascript5/f'nction )ali!ateF9in!o9.alert50oo# a!!e! to cart5@J3script/h align45center5/0oo#s3h/form action45cart.html5 metho!45post5/

    ta*le align45center5 *or!er4515 9i!th45675/tr/th 9i!th451675/"ame3th/th/Logo3th/th/A'thor3th/th/P'*lication3th/th/Price3th/th/art3th/3tr/

    tr align45center5/t!/ML 0i*le3t!/t!/img src45images3-ml*i*leco)er.Dpg5 9i!th45N65 height4575 3/3t!/t!/Elliotte %'st= Harol!3t!/t!/H'ngr= Min!s3t!/t!/ Q21.3t!/t!/inp't t=pe45s'*mit5 onlic#45)ali!ate@5 )al'e45A!! to cart5/3t!/3tr/tr align45center5/

    t!/Artificial Intelligence: A Mo!ern Approach 3t!/t!/img src45images3AI.Dpg5 9i!th45O75 height4575 3/3t!/t!/t'art R. %'ssell3t!/t!/Princeton Hall3t!/t!/ Q.73t!/t!/inp't t=pe45s'*mit5 onlic#45)ali!ate@5 )al'e45A!! to cart5/3t!/3tr/

  • 8/12/2019 Wt Record With Outputs

    8/61

    tr align45center5/t!/0eginning Ra)a 23t!/t!/img src45images3Da)a.Dpg5 9i!th45N65 height4575 3/3t!/t!/I)or Horton3t!/t!/9ro-3t!/t!/ QO.63t!/t!/inp't t=pe45s'*mit5 onlic#45)ali!ate@5 )al'e45A!! to cart5/3t!/3tr/tr align45center5/t!/HTML6: p an! %'nning3t!/t!/img src45images3HTML6?p?An!?%'nning.Dpg5 9i!th45N65 height45753/3t!/t!/Mar# Pilgrim3t!/t!/+G%EILLC3t!/t!/ Q1N.3t!/t!/inp't t=pe45s'*mit5 onlic#45)ali!ate@5 )al'e45A!! to cart5/3t!/

    3tr/3ta*le/3form/cart.html

    h; align45center5/hopping art3h;/ta*le align45center5 *or!er4515 9i!th45;775/tr/th/0oo# "ame3th/

    th/Price3th/th/S'antit=3th/th/Amo'nt3th/3tr/tr align45center5/t!/ML 0i*le3t!/t!/ Q21.3t!/t!/23t!/t!/ Q;.O3t!/

    3tr/tr align45center5/t!/HTML6: p an! %'nning3t!/t!/ Q1N.3t!/t!/13t!/

  • 8/12/2019 Wt Record With Outputs

    9/61

    t!/ Q1N.3t!/3tr/tr align45center5/t! colspan455/Total Amo'nt:3t!/t!/ Q1.N3t!/3tr/3ta*le/

  • 8/12/2019 Wt Record With Outputs

    10/61

    OUT!UT

    IN"E#$

    HOME $

  • 8/12/2019 Wt Record With Outputs

    11/61

    "E!T$

  • 8/12/2019 Wt Record With Outputs

    12/61

    LOGIN$

    REGISTRATION$

  • 8/12/2019 Wt Record With Outputs

    13/61

    CATALOGUE$

    CART$

  • 8/12/2019 Wt Record With Outputs

    14/61

    WEE% &

    Aim$

    A 'a(a Scri)t !rogram to *ali+ate the Registration !age.

    !ROGRAM$

    html/hea!/title/ %egistration3title/script t=pe45te-t3Da)ascript5/f'nction )ali!ateFre 4 3UA?Va?

  • 8/12/2019 Wt Record With Outputs

    15/61

    *o!=/h; align45center5/%egistration3h;/form name45registration5 metho!45post5 action45%egistration.html5/ta*le align45center5 height45;675/tr/t!/"ame:3t!/t!/inp't t=pe45te-t5 name45name5 i!45name5 3/3t!/3tr/tr/t!/Pass9or!:3t!/t!/inp't t=pe45pass9or!5 name45pass5 i!45pass5 3/3t!/3tr/tr/t!/E?mail I:3t!/t!/inp't t=pe45te-t5 name45email5 3/3t!/3tr/

    tr/t!/Phone n'm*er:3t!/t!/inp't t=pe45te-t5 name45phno5 3/3t!/3tr/tr/t!/e-:3t!/t!/inp't t=pe45ra!io5 name45se-5 )al'e45male5 3/ Maleinp't t=pe45ra!io5 name45se-5 )al'e45female5 3/ (emale3t!/3tr/

    tr/t!/ate of 0irth M C:3t!/t!/select/ option )al'e4515 name45!5/13option/ option )al'e4525name45!5/23option/ option )al'e455 name45!5/3option/ option )al'e45;5name45!5/;3option/ option )al'e4565 name45!5/63option/ option )al'e455

    name45!5/3option/ option )al'e45N5 name45!5/N3option/ option )al'e45O5name45!5/O3option/ option )al'e455 name45!5/3option/ option )al'e45175name45!5/173option/ option )al'e45e45!5/123option/ option )al'e4515

  • 8/12/2019 Wt Record With Outputs

    16/61

    name45!5/13option/ option )al'e451;5 name45!5/1;3option/ option )al'e45165name45!5/163option/ option )al'e4515 name45!5/13option/ option )al'e451N5name45!5/1N3option/ option )al'e451O5 name45!5/1O3option/ option )al'e4515name45!5/13option/ option )al'e45275 name45!5/273option/ option )al'e45215name45!5/213option/ option )al'e45225 name45!5/223option/ option )al'e4525name45!5/23option/ option )al'e452;5 name45!5/2;3option/ option )al'e45265name45!5/263option/ option )al'e4525 name45!5/23option/ option )al'e452N5name45!5/2N3option/ option )al'e452O5 name45!5/2O3option/ option )al'e4525

    name45!5/23option/ option )al'e4575 name45!5/73option/ option )al'e4515name45!5/13option/3select/select/option )al'e4515 name45m5/13option/ option )al'e4525name45m5/23option/option )al'e455 name45m5/3option/ option )al'e45;5name45m5/;3option/

    option )al'e4565 name45m5/63option/ option )al'e455name45m5/3option/option )al'e45N5 name45m5/N3option/ option )al'e45O5name45m5/O3option/option )al'e455 name45m5/3option/ option )al'e45175name45m5/173option/option )al'e45115 name45m5/113option/ option )al'e45125name45m5/123option/3select/

    select/option )al'e451OO5 name45=5/1OO3option/ option )al'e451O5name45=5/1O3option/option )al'e45175 name45=5/173option/ option )al'e45115name45=5/113option/option )al'e45125 name45=5/123option/ option )al'e4515name45=5/13option/

  • 8/12/2019 Wt Record With Outputs

    17/61

    3*3select/3t!/3tr/tr/t!/Lang'ages Kno9n:3t!/t!/inp't t=pe45chec#*o-5 name45english5 )al'e45english5 3/ Englishinp't t=pe45chec#*o-5 name45tel'g'5 )al'e45tel'g'5 3/ Tel'g'inp't t=pe45chec#*o-5 name45hin!i5 )al'e45tel'g'5 3/ Hin!iinp't t=pe45chec#*o-5 name45tamil5 )al'e45tamil5 3/ Tamil3t!/3tr/tr/t!/A!!ress:3t!/t!/te-tarea ro9s45;5 cols4575 name45a!!ress5/3te-tarea/ 3t!/3tr/

    tr/t! colspan4525 align45center5/inp't )al'e45%egister5 t=pe45s'*mit5 onlic#45)ali!ate@5 3/3t!/3tr/3ta*le/3*o!=/3html/

  • 8/12/2019 Wt Record With Outputs

    18/61

    OUTPUT:

  • 8/12/2019 Wt Record With Outputs

    19/61

    WEE% ,

    Aim$

    To "esign a -e !age sing CSS/Casca+ing St0le Sheet1.

    i1 Use +i22erent 2ont St0les

    ii1 Set a Bac3 gron+ 2or oth )ages an+ single elements

    iii1 Control the re)etition o2 image -ith ac3gron+ re)eat )ro)ert0 i(1 -or3 -ith La0ers

    (1 A++ cstomi4e+ crsors

    !ROGRAM$

    html/hea!/title/3title/

    st=le t=pe45te-t3css5/PFcolor:re!@font?si

  • 8/12/2019 Wt Record With Outputs

    20/61

    *o!=/center/p/This is normal paragraph tag.3p/a href45Z5/This is normal anchor tag.3a/*r/*r/* align45center5/La=er1 on top:3*/!i) st=le45position:relati)e@ font?si

  • 8/12/2019 Wt Record With Outputs

    21/61

    OUT!UT$

  • 8/12/2019 Wt Record With Outputs

    22/61

    WEE% 5

    Aim$

    To Im)lement an #ML 2ile -hich -ill "is)la0 the Boo3 in2ormation

    -hich incl+es the 2ollo-ing$

    i1 Title o2 the oo3

    ii1 ISBN nmeriii1 !lisher name

    i(1 E+ition

    (1 !rice

    !ROGRAM$

    oo3.+t+$

    ELEME"T *oo#!etails *oo#/ELEME"T *oo# title$a'thor$is*n$p'*lisher$e!ition$price/ELEME"T title ZPATA/ELEME"T a'thor ZPATA/ELEME"T is*n ZPATA/ELEME"T p'*lisher ZPATA/ELEME"T e!ition ZPATA/

    ELEME"T price ZPATA/

  • 8/12/2019 Wt Record With Outputs

    23/61

    oo3.6ml$

    [-ml )ersion451.75 enco!ing45T(?O5[/[-ml?st=lesheet t=pe45te-t3-sl5 href45*oo#.-sl5[/+TCPE *oo# CTEM 5*oo#.!t!5/

    *oo#!etails/*oo#/title/ML 0i*le3title/a'thor/Elliotte %'st= Harol!3a'thor/is*n/ON6;2173is*n/p'*lisher/H'ngr= Min!s3p'*lisher/e!ition/;th3e!ition/price/Q21.3price/3*oo#/*oo#/title/Artificial Intelligence: A Mo!ern Approach3title/a'thor/t'art R. %'ssell3a'thor/is*n/ON6;2273is*n/p'*lisher/Princeton Hall3p'*lisher/e!ition/th3e!ition/price/Q.73price/3*oo#/*oo#/title/0eginning Ra)a 23title/

    a'thor/I)or Horton3a'thor/is*n/ON6;2273is*n/p'*lisher/9ro-3p'*lisher/e!ition/th3e!ition/price/QO.63price/3*oo#/*oo#/title/HTML6: p an! %'nning3title/a'thor/Mar# Pilgrim3a'thor/

    is*n/12;6NO73is*n/p'*lisher/+G%EILLC3p'*lisher/e!ition/1st3e!ition/price/Q1N.3price/3*oo#/3*oo#!etails/

  • 8/12/2019 Wt Record With Outputs

    24/61

    oo3.6sl

    [-ml )ersion451.75 enco!ing45I+?OO6?15[/

    -sl:st=lesheet )ersion451.75-mlns:-sl45http:33999.9.org313L3Transform5/-sl:template match4535/html/*o!=/ h2 st=le45color:green@5 align45center5/0oo#s3h2/ta*le *or!er4515align45center5/ tr st=le45color:gre=@5/th/Title3th/th/A'thor3th/th/I0"3th/th/P'*lisher3th/ th/E!ition3th/ th/Price3th/3tr/

    -sl:for?each select45*oo#!etails3*oo#5/tr/ t! st=le45font?famil=:Gomic ans MG@ color:re!@5/-sl:)al'e?ofselect45title53/3t!/ t! st=le45te-t?transform: capitali

  • 8/12/2019 Wt Record With Outputs

    25/61

    OUT!UT

  • 8/12/2019 Wt Record With Outputs

    26/61

    WEE% 7

    Aim$

    A Sim)le *isal ean -ith an area 2ille+ -ith Color.

    !rogram$

    "e(elo)ing a Sim)le Bean Using the B"%$

    This section presents an e-ample that sho9s ho9 to !e)elop a simple0ean an! connect it to other components )ia the 0K. +'r ne9 component iscalle! the Colors 0ean. It appears as either a rectangle or ellipse that is fille!9ith a color. A color is chosen at ran!om 9hen the 0ean *egins e-ec'tion. A

    p'*lic metho! can *e in)o#e! to change it. Each time the mo'se is clic#e! onthe 0ean$ another ran!om color is chosen. There is one oolean rea!39rite

    propert= that !etermines the shape. The 0K is 'se! to la= o't an application9ith one instance of the Colors 0ean an! one instance of the OrBtton 0ean.The *'tton is la*ele! \hange.B Each time it is presse!$ the color changes.E]EL+PME"TI", RA]A

    Create a Ne- Bean $

    Here are the steps that =o' m'st follo9 to create a ne9 0ean:1. reate a !irector= for the ne9 0ean.

    2. reate the Ra)a so'rce files.. ompile the so'rce files.;. reate a manifest file.6. ,enerate a RA% file.. tart the 0K.N. Test.

    The follo9ing sections !isc'ss each of these steps in !etail.

    reate a irector= for the "e9 0ean Co' nee! to ma#e a !irector= forthe 0ean. To follo9 along 9ith this e-ample$ createc$8+38+emo8sn-8+emo8colors. Then change to that !irector=. The olors an!+'r0'tton 0eans reate the o'rce (ile for the "e9 0ean The so'rce co!e forthe Colors component is sho9n in the follo9ing listing. It is locate! in the fileColors.9a(a. The im)ort statement at the *eginning of the file places it in the

    pac#age name! sn-.+emo.colors. %ecall from hapter that the !irector=hierarch= correspon!s to the pac#age hierarch=. Therefore$ this file m'st *elocate! in a s'*!irector= name! sn-8+emo8colors relati)e to theCLASS!ATH en)ironment )aria*le. The color of the component is !etermine!

    *= the pri)ate Color )aria*le color$ an! its shape is !etermine! *= the pri)ateoolean )aria*le rectanglar. The constr'ctor !efines an anon=mo's innerclass that e-ten!s MoseA+a)ter an! o)erri!es its mose!resse+/ 1 metho!.The change/ 1 metho! is in)o#e! in response to mo'se presses. The component

  • 8/12/2019 Wt Record With Outputs

    27/61

    is initiali

  • 8/12/2019 Wt Record With Outputs

    28/61

    ifrectang'lar Fg.fill%ect7$ 7$ 9?1$ h?1@Jelse Fg.fill+)al7$ 7$ 9?1$ h?1@JJ

    J

    ompile the o'rce o!e for the "e9 0ean ompile the so'rce co!e to create aclass file. T=pe the follo9ing:

    Da)ac olors.Da)a.reate a Manifest (ile Co' m'st no9 create a manifest file. (irst$ s9itch to thec$8+38+emo !irector=. This is the !irector= in 9hich the manifest files for the0K !emos are locate!. P't the so'rce co!e for =o'r manifest file in the file

    colors.m2t.

    It is sho9n here:"ame: s'n93!emo3colors3olors.classRa)a?0ean: Tr'e

    This file in!icates that there is one .class file in the RA% file an! that it is aRa)a 0ean "otice that the Colors.class file is in the pac#age sn-.+emo.colorsan! in the s'*!irector= sn-8+emo8colors relati)e to the c'rrent !irector=.

    ,enerate a RA% (ile 0eans are incl'!e! in the Tool0o- 9in!o9 of the 0Konl= if the= are in RA% files in the !irector= c$8+389ars. These files aregenerate! 9ith the Dar 'tilit=.

    Enter the follo9ing:Dar cfm ..^Dars^colors.Dar colors.mft s'n9^!emo^colors^8.classThis comman! creates the file colors.9ar an! places it in the !irector=c$8+389ars.

    Co' ma= 9ish to p't this in a *atch file for f't're 'se. tart the 0K hange to the !irector= c$8+38eano6 an! t=pe rn. Thisca'ses the 0K to start. Co' sho'l! see three 9in!o9s$ title! Tool0o-$0ean0o-$ an! Properties. The Tool0o- 9in!o9 sho'l! incl'!e an entr= la*ele!\olorsB for =o'r ne9 0ean. reate an Instance of the olors 0ean After =o'complete the prece!ing steps$ create an instance of the Colors 0ean in the0ean0o- 9in!o9. Test =o'r ne9 component *= pressing the mo'se an=9here9ithin its *or!ers. Its color imme!iatel= changes. se the Properties 9in!o9 tochange the rectanglar propert= from 2alse to tre. Its shape imme!iatel=changes.

  • 8/12/2019 Wt Record With Outputs

    29/61

    reate an! onfig're an Instance of the +'r0'tton 0ean reate an instance ofthe OrBtton 0ean in the 0ean0o- 9in!o9. Then follo9 these steps:

    1. ,o to the Properties 9in!o9 an! change the la*el of the 0ean to \hangeB.Co' sho'l! see that the *'tton appearance changes imme!iatel= 9hen this

    propert= is change!.2. ,o to the men' *ar of the 0ean0o- an! select E!it Y E)ents Y action Y

    actionPerforme!.. Mo)e the c'rsor so that it is insi!e the Colors 0ean !ispla= area$ an! clic#the left mo'se *'tton. Co' sho'l! see the E)ent Target ialog !ialog *o-.;. The !ialog *o- allo9s =o' to choose a metho! that sho'l! *e in)o#e! 9henthis *'tton is clic#e!. elect the entr= la*ele! \changeB an! clic# the +K

    *'tton.Co' sho'l! see a message *o- appear )er= *riefl=$ stating that the toolis\,enerating an! compiling a!aptor class.B6. lic# on the *'tton. Co' sho'l! see the color change. Co' might 9ant toe-periment 9ith the Colors 0ean a *it *efore mo)ing on.

    +'tp't:

  • 8/12/2019 Wt Record With Outputs

    30/61

  • 8/12/2019 Wt Record With Outputs

    31/61

    WEE% :

    Aim $

    Install TOMCAT -e ser(er an+ A!ACHE.

    While installation assign )ort nmer ;

  • 8/12/2019 Wt Record With Outputs

    32/61

  • 8/12/2019 Wt Record With Outputs

    33/61

  • 8/12/2019 Wt Record With Outputs

    34/61

  • 8/12/2019 Wt Record With Outputs

    35/61

    WEE% ;

    Aim$Assme 2or sers ser>=ser?=ser& an+ ser, ha(ing the )ass-or+s )-+>=)-+?=)-+&

    an+ )-+, res)ecti(el0. Write a ser(elet 2or +oing the 2ollo-ing.

    >. Create a Coo3ie an+ a++ these 2or ser i+@s an+ )ass-or+s to this Coo3ie.

    ?. Rea+ the ser i+ an+ )ass-or+s entere+ in the Login 2orm /-ee3>1

    !ROGRAM$

    A++coo3.9a(a

    import Da)a.io.I+E-ception@import Da)a.io.PrintWriter@import Da)a-.ser)let.er)letE-ception@import Da)a-.ser)let.http.oo#ie@import Da)a-.ser)let.http.Httper)let@

    import Da)a-.ser)let.http.Httper)let%e>'est@import Da)a-.ser)let.http.Httper)let%esponse@

    p'*lic class A!!coo# e-ten!s Httper)letF X+)erri!e

    p'*lic )oi! ser)iceHttper)let%e>'est re>$Httper)let%esponse resthro9s er)letE-ception$I+E-ceptionF res.setontentT=pe5te-t3html5@PrintWriter o't4res.getWriter@

    oo#ie c14ne9 oo#ie5'sr15$5s'ni5@oo#ie p14ne9 oo#ie5p9!15$5ani5@oo#ie c24ne9 oo#ie5'sr25$5a*c5@oo#ie p24ne9 oo#ie5p9!25$5125@oo#ie c4ne9 oo#ie5'sr5$5!ef5@oo#ie p4ne9 oo#ie5p9!5$5;65@oo#ie c;4ne9 oo#ie5'sr;5$5mno5@oo#ie p;4ne9 oo#ie5p9!;[email protected]!!oo#iec1@

    res.a!!oo#[email protected]!!oo#[email protected]!!oo#iep2@

  • 8/12/2019 Wt Record With Outputs

    36/61

    res.a!!oo#[email protected]!!oo#[email protected]!!oo#iec;@res.a!!oo#iep;@o't.println5++KIE AE5@J J

    login.html

    html/hea!/title/L+,I"3title/3hea!/*o!=/h; align45center5/L+,I"3h;/ta*le align45center5/

    form metho!45get5 action45login5/tr/t!/ser I:3t!/t!/inp't t=pe45te-t5 name45'sr5 3/3t!/3tr/tr/t!/Pass9or!:3t!/t!/inp't t=pe45pass9or!5 name45p9!5 3/3t!/3tr/

    tr/t! colspan4525 align45center5/inp't )al'e45Login5 t=pe45s'*mit5onclic#45)ali!ate@5 3/3t!/3tr/3ta*le/3*o!=/3html/

    cart.html

    h; align45center5/hopping art3h;/ta*le align45center5 *or!er4515 9i!th45;775/tr/th/0oo# "ame3th/th/Price3th/th/S'antit=3th/

  • 8/12/2019 Wt Record With Outputs

    37/61

    th/Amo'nt3th/3tr/tr align45center5/t!/ML 0i*le3t!/t!/ Q21.3t!/t!/23t!/t!/ Q;.O3t!/3tr/tr align45center5/t!/HTML6: p an! %'nning3t!/t!/ Q1N.3t!/t!/13t!/t!/ Q1N.3t!/3tr/tr align45center5/

    t! colspan455/Total Amo'nt:3t!/t!/ Q1.N3t!/3tr/3ta*le/

    login.9a(a

    import Da)a.io.I+E-ception@import Da)a.io.PrintWriter@import Da)a-.ser)let.%e>'estispatcher@import Da)a-.ser)let.er)letE-ception@import Da)a-.ser)let.http.oo#ie@import Da)a-.ser)let.http.Httper)let@import Da)a-.ser)let.http.Httper)let%e>'est@import Da)a-.ser)let.http.Httper)let%esponse@

    p'*lic class login e-ten!s Httper)let

    F tring 'ser$pas@ pri)ate %e>'estispatcher r!@ X+)erri!e

    p'*lic )oi! ser)iceHttper)let%e>'est re>$Httper)let%esponse resthro9s er)letE-ception$I+E-ception

  • 8/12/2019 Wt Record With Outputs

    38/61

    F res.setontentT=pe5te-t3html5@PrintWriter o't4res.getWriter@'ser4re>.getParameter5'sr5@

    pas4re>.getParameter5p9!5@oo#ieU c4re>.getoo#ies@forint [email protected]@iF ifcUi.get"ame.e>'als5'sr15&&cUi1.get"ame.e>'als5p9!15YYcUi.get"ame.e>'als5'sr25 &&cUi1.get"ame.e>'als5p9!25YYcUi.get"ame.e>'als5'sr5&& cUi1.get"ame.e>'als5p9!5YYcUi.get"ame.e>'als5'sr;5&& cUi1.get"ame.e>'als5p9!;5 F if'ser.e>'alscUi.get]al'e &&

    pas.e>'alscUi1.get]al'e F 33%e>'estispatcherr!4re>.get%e>'estispatcher53cart.html5@r!.for9ar!re>$res@

    JelseF o't.println5C+ A%E "+T ATH+%IE E% [email protected]!%e!irect53login.html5@JJJJJ

    login>.html

    html/

    hea!/title/L+,I"3title/3hea!/*o!=/h; align45center5/L+,I"3h;/ta*le align45center5/form metho!45get5 action45login15/tr/t!/ser I:3t!/t!/inp't t=pe45te-t5 name45'ser5 3/3t!/

    3tr/tr/t!/Pass9or!:3t!/t!/inp't t=pe45pass9or!5 name45p9!5 3/3t!/3tr/

  • 8/12/2019 Wt Record With Outputs

    39/61

    tr/t! colspan4525 align45center5/inp't )al'e45Login5 t=pe45s'*mit5onclic#45)ali!ate@5 3/3t!/3tr/3ta*le/3*o!=/3html/

    login>.9a(a

    import Da)a.io.I+E-ception@import Da)a.io.PrintWriter@import Da)a-.ser)let.8@

    p'*lic class login1 e-ten!s ,enericer)letF

    pri)ate tring'ser1$p9!1$'ser2$p9!2$'ser$p9!$'ser;$p9!;$'ser6$p9!6@

    X+)erri!ep'*lic )oi! initer)letonfig scF'ser14sc.getInitParameter5'sername15@

    p9!14sc.getInitParameter5pass9or!15@'ser24sc.getInitParameter5'sername25@

    p9!24sc.getInitParameter5pass9or!25@'ser4sc.getInitParameter5'sername5@

    p9!4sc.getInitParameter5pass9or!5@'ser;4sc.getInitParameter5'sername;5@

    p9!;4sc.getInitParameter5pass9or!;5@J X+)erri!ep'*lic )oi! ser)iceer)let%e>'est re>$er)let%esponse resthro9ser)letE-ception$I+E-ception

    F res.setontentT=pe5te-t3html5@PrintWriter o't4res.getWriter@'ser64re>.getParameter5'ser5@

    p9!64re>.getParameter5p9!5@

  • 8/12/2019 Wt Record With Outputs

    40/61

    if'ser6.e>'als'ser1&&p9!6.e>'alsp9!1YY'ser6.e>'als'ser2&&p9!6.e>'alsp9!2YY'ser6.e>'als'ser&&p9!6.e>'alsp9!YY'ser6.e>'als'ser;&&p9!6.e>'alsp9!;o't.println5p/ 9elcome to5'ser6.topperase@elseo't.println5Co' are not a'thori

  • 8/12/2019 Wt Record With Outputs

    41/61

    init?param/param?name/pass9or!3param?name/param?)al'e/p)psit3param?)al'e/3init?param/init?param/param?name/'sername;3param?name/param?)al'e/9t3param?)al'e/3init?param/init?param/param?name/pass9or!;3param?name/param?)al'e/la*3param?)al'e/3init?param/3ser)let/ser)let?mapping/ser)let?name/E-ample3ser)let?name/'rl?pattern/3e-13'rl?pattern/

    3ser)let?mapping/39e*?app/

  • 8/12/2019 Wt Record With Outputs

    42/61

    OUT!UT$

  • 8/12/2019 Wt Record With Outputs

    43/61

  • 8/12/2019 Wt Record With Outputs

    44/61

  • 8/12/2019 Wt Record With Outputs

    45/61

    WEE%

    Aim$Create a tale -hich shol+ contain at least the 2ollo-ing 2iel+s$ name= )ass-or+= email

    i+= )hone nmer/these shol+ hol+ the +ata 2rom the registration 2orm1.

    Write a 9a(a )rogramser(let'S! to connect to that +ataase an+ e6tract +ata 2rom the

    tales an+ +is)la0 them. E6)eriment -ith (arios SDL eries.

    Insert the +etails o2 the sers -ho register -ith the -e site= -hene(er a ne- ser clic3sthe smit tton in the registration )age .

    !ROGRAM$

    Registration.html

    hea!/title/%egistration page3title/

    3hea!/*o!=/form METH+45P+T5 ATI+"45register5/E"TE%/ta*le/center/tr/ t!/ sername 3t!/t!/inp't t=pe45te-t5 name45'sr5/ 3t!/ 3tr/tr/t!/ Pass9or! 3t!/

    t!/inp't t=pe45pass9or!5 name45p9!5/ 3t!/ 3tr/tr/t!/Age3t!/t!/inp't t=pe45te-t5 name45age5/ 3t!/ 3tr/tr/ t!/A!!ress3t!/t!/ inp't t=pe45te-t5 name45a!!5/ 3t!/ 3tr/tr/ t!/email3t!/t!/ inp't t=pe45te-t5 name45mail5/ 3t!/ 3tr/tr/ t!/Phone3t!/t!/ inp't t=pe45te-t5 name45phone5/ 3t!/ 3tr/tr/ t! colspan42 align4center/ inp't t=pe45s'*mit5 )al'e45s'*mit5/ 3t!/3tr/3center/3ta*le/3form/3*o!=/

  • 8/12/2019 Wt Record With Outputs

    46/61

    login.html

    html/hea!/title/Login page3title/3hea!/*o!=/ center/ ta*le/form METH+45P+T5 ATI+"45login5/tr/ t!/ sername 3t!/t!/inp't t=pe45te-t5 name45'sr5/3t!/ 3tr/tr/ t!/ Pass9or! 3t!/t!/ inp't t=pe45pass9or!5 name45p9!5/ 3t!/ 3tr/tr/ t! align4center colspan4525/inp't t=pe45s'*mit5 )al'e45s'*mit5/3t!/3tr/3ta*le/ 3center/3form/

    3*o!=/3html/

    Ini.9a(a

    import Da)a-.ser)let.8@import Da)a.s>l.8@import Da)a.io.8@

    p'*lic class Ini e-ten!s ,enericer)let

    F pri)ate tring 'ser1$p9!1$email1@p'*lic )oi! ser)iceer)let%e>'est re>$er)let%esponse res thro9ser)letE-ception$I+E-ceptionF'ser14re>.getParameter5'ser5@

    p9!14re>.getParameter5p9!5@email14re>[email protected]=pe5te-t3html5@PrintWriter o't4res.getWriter@

    tr=Flass.for"ame5oracle.D!*c.!ri)er.+racleri)er5@onnection con4ri)erManager.getonnection5D!*c:oracle:thin5$5scott5$5tiger5@

  • 8/12/2019 Wt Record With Outputs

    47/61

    Prepare!tatement st4con.preparetatement5insert into personal)al'es[$[$[$[$[$[[email protected]$'[email protected][email protected][email protected];[email protected][email protected]$5212;[email protected]'[email protected]@JcatchSLE-ception sF o't.println5not fo'n! 5s@Jcatchlass"ot(o'n!E-ception cF o't.println5not fo'n! 5c@

    JJJ

    -e.6ml$

    9e*?app/ser)let/ser)let?name/init13ser)let?name/ser)let?class/Ini3ser)let?class/

    3ser)let/ser)let?mapping/ser)let?name/init13ser)let?name/'rl?pattern/3register3'rl?pattern/3ser)let?mapping/39e*?app/

  • 8/12/2019 Wt Record With Outputs

    48/61

    OUT!UT$

  • 8/12/2019 Wt Record With Outputs

    49/61

  • 8/12/2019 Wt Record With Outputs

    50/61

    WEE%>l.8@import Da)a-.ser)let.er)letE-ception@

    import Da)a-.ser)let.http.Httper)let@import Da)a-.ser)let.http.Httper)let%e>'est@import Da)a-.ser)let.http.Httper)let%esponse@

    p'*lic class %etrie)e e-ten!s Httper)letF X+)erri!ep'*lic )oi! ser)iceHttper)let%e>'est re>$Httper)let%esponse resthro9s er)letE-ception$I+E-ceptionF res.setontentT=pe5te-t3html5@PrintWriter o't4res.getWriter@

    tr=Flass.for"ame5oracle.D!*c.!ri)er.+racleri)er5@onnectioncon4ri)erManager.getonnection5D!*c:oracle:thin5$5scott5$5tiger5@tatement s4con.createtatement@%es'ltet r4s.e-ec'teS'er=5select 8 from cart5@o't.println5center/ ta*le *or!er41/5@o't.println5thea!/ th/ 0oo# name 3th/ th/ Price 3th/ th/S'antit=3th/ th/ Amo'nt 3th/ 3thea!/5@

    9hiler.ne-tF o't.println5tr/ t!/ 5r.gettring153t!/ 5@o't.println5t!/ 5r.gettring253t!/ 5@

  • 8/12/2019 Wt Record With Outputs

    54/61

    o't.println5t!/ 5r.getInt53t!/ 5@o't.println5t!/ 5r.gettring;53t!/ 3tr/5@J o't.println53ta*le/3center/[email protected]@JcatchSLE-ception s>F o't.println5s>l e-ception5s>@Jcatchlass"ot(o'n!E-ception clF o't.println5class not fo'n!5cl@JJJ

    -e.6ml

    setCartenterdisplayRetrieveset/enterdata

    display/display1

  • 8/12/2019 Wt Record With Outputs

    55/61

    Ot)t$

  • 8/12/2019 Wt Record With Outputs

    56/61

    WEE%>?

    Aim$HTT! is a stateless )rotocol. Session is reire+ to maintain the state. The ser ma0

    a++ some items to cart 2rom the catalog )age. He can chec3 the cart )age 2or items. He

    ma0 (isit cataloge again an+ select some more items. Here or interest is the selecte+

    items shol+ e a++e+ to ol+er cart rather than ne- cart.

    !ROGRAM$

    Cataloge.9a(a

    import Da)a.io.I+E-ception@import Da)a.io.PrintWriter@import Da)a.'til.Arra=List@import Da)a-.ser)let.er)letonfig@

    import Da)a-.ser)let.er)letE-ception@import Da)a-.ser)let.http.Httper)let@import Da)a-.ser)let.http.Httper)let%e>'est@import Da)a-.ser)let.http.Httper)let%esponse@import Da)a-.ser)let.http.Httpession@

    p'*lic class atalog'e e-ten!s Httper)letF int itemco'nt47@ X+)erri!e

    p'*lic )oi! initer)letonfig config thro9s

    er)letE-ceptionF s'per.initconfig@J X+)erri!e

    p'*lic )oi! ser)iceHttper)let%e>'estre>$Httper)let%esponse res thro9sI+E-ception$er)letE-ceptionF res.setontentT=pe5te-t3html5@PrintWriter p94res.getWriter@Httpession hs4re>.getession@

    Arra=List cart4Arra=Lisths.getAttri*'te5cart5@ifcart4n'll

  • 8/12/2019 Wt Record With Outputs

    57/61

    F itemco'nt4cart.si'est@import Da)a-.ser)let.http.Httper)let%esponse@import Da)a-.ser)let.http.Httpession@

    p'*lic class art e-ten!s Httper)letF X+)erri!ep'*lic )oi! initer)letonfig config thro9s er)letE-ceptionF s'per.initconfig@J X+)erri!ep'*lic )oi! ser)iceHttper)let%e>'estre>$Httper)let%esponse res thro9sI+E-ception$er)letE-ception

  • 8/12/2019 Wt Record With Outputs

    58/61

    F res.setontentT=pe5te-t3html5@PrintWriter p94res.getWriter@Httpession hs4re>.getession@Arra=List cart4Arra=Lisths.getAttri*'te5cart5@ifcart44n'llF p9.println5"o items in =o'r cart5@cart4ne9 [email protected]*'te5cart5$cart@J tring itemselecte!U@tring item@itemselecte!4re>.getParameter]al'es5*oo#5@ifitemselecte!4n'llF forint i47@iitemselecte!.length@iF [email protected]!!item@

    JJp9.println5Items in the cart*r/5@Iterator [email protected]"e-tF p9.println5*r/*/5it.ne-t53*/5@J JJ

    We.6ml

    LoginLoginusernamesyampasswordsyam

    Login/login.do

  • 8/12/2019 Wt Record With Outputs

    59/61

    catCataloguecat/Cat

    cart

  • 8/12/2019 Wt Record With Outputs

    60/61

    Ot)t$

  • 8/12/2019 Wt Record With Outputs

    61/61