Welcome to Scribd!
Academic Documents
Professional Documents
Culture Documents
Hobbies & Crafts Documents
Personal Growth Documents
jdbcservletjspJAVA Class Notes
home ”) 5 J 7 80Ger J relative veL Iyaass xen! ceo fegue VolerSrv servier fregram with “/vturl” aL pobiero Reqest URL }o fest te applicaton eee! / localhost: 2029/ voleApp/ personal: hiro) 27 200929900 erececoescestcocoeecocogese foe ea oOoCOS29OD2D09995 oe CveoceccooeccueccocagooagoON 7 @ our servler program ag flexible Servlet program working, for both ger’, Post hep request meltods we con use one of the follooirg Hore affroaches « Approach (1) ; By Keeping serviceC-»-) method fn our Servier Program Public closs VolerSrv extends HetpServier t public void Service CHEepServlerRewest req, HebpServieHRe sponse eS) throws servlerExcephion , TOG Xception t - Ueeqmesr processiog legic 4 3 NOTE! the servicet-,-) method of our servier program can frewess bol Be", ‘post’ weitod' based reqpest - But keeping request processing lngie fo seevicet-/-?_ method 36 not industry stondond 20 try to keep request processing logic in doXa method: Approach): 84 overriding wath doGerc—-), doPostt-.-) method but keep reqwest processing 109’C fo ore melted and call that rmethed from arciber retool Public dass VvolerSru extends HtPServier $ Pubic void dacer (Hetpservler Reqest. remy, HLipserviehResponse res) throws Servlebexcpiten, Tobxcepton Heenpesr processing logic 3 public yetd doPosr C HetpsevierRequesr req, HetSevlerResponse res) throws Sevier Exeephion , Toexception 3 5 doGiek (rea, res); eeNOTE: Here Servier Programm cON Process both Ger, Host method boseol reqest- tere, request praessing logic 12 oot duplicated - Prprench)! keep request processing lagic fn a user-defined mettad and call that method from both dodset (-)-) -dofost(—-—) method publre dass VolrSrv eatends Httpserviet Public void YS ( HetpServlerReques: req, HetpSen/lerResponse, res) throws ServlerExceptton, FOE ¥ception Z renpest Processing logic a Public void doGer (HeipServier Request req, HEtp Servier Response) Throws Servertxcephon, FoGeception 4 4 Public void doPosr CikupServierReqest req, HeipsenietResponse es) Ugh (rey, res); throws ServietExce pion, ToExcepiion mya (rey, res) 3 +here the key benifits ane some as approach @) ¥ Programmers generally prefer using approach @) or approach (3) io make Heer Servet Programs a flexcble Servlet Programe agains: jag hetP request melhods bef, post”. cinak happens if Programmer calls deshoy 6) wetted plicctly fram explicctly fro the service (---) meted OF seevier Program? 9) servlet container wit nat deshoy our servlet class chjeck but logic of destroy, ) methool exeutes along with Service (-7-) methods x chen fife cycle event 1S raised Bolen ee ee le urektod + Since the Programmer has called Life cle methed! auromaé cally 29 ecenreecoecoece rm oe@eeeoocool oon go oo lf t739099995> me servier Container never raises the ‘fefe wyde event 5 whar happens ff ioirc- ) welbad jf called explicitly fron the : service (---) method of Servier Frogram? > pi servier Contotner never Geaks new oblect of Our senvier class for ° the oteve call but logic. of foikC- > method exeoujes along with Service Gr=) method ) what ys the difference between hetPReqest method GET and post 7 7 ; oer posT 1 #pesten te gaher data from sever | xpestgn fo send data to He Server . bY generakng request along wilt jhe request DO ® BET send limited amount of dala | x zr con send unlimited osmouor of _ along with the reqwest. (max of date. along wilh the request. 256 kb) ton i ; ae The. eo pagexquery sing ail! The fer page ~query steing will cot appear tn erowsede odldeess ban appear 75 browser's addess bom © 80 90 data sera so dato, secacy 3 aWorlable ° Nok sitable for fle uploading eco ° . © % Gan por send daa in encrypted * can send: ; formar OF USe dOGerCD methed or Servicetes) _ method fo Process tHe request mélhod 40 process the request + GSE 8 fer Tdempotnt F Post is mor rdempotect efaulk request method of HEPREWe| + ig not default and should be opp _ ked explicctly. +r iB recommanded to design form pages by having Post method tHaperliok generated reqestS ane ger memod tased requests where AS jhe form pige can generate ether ger or post werhod + based req vest: y XK Before Gaeplehing the request processing of given reavest iF clitor 7] eee ee ==ollowed fo enerole next request andi web applicaken iS processing wih ye reqwest then jr 12 called as dovble pestteg problem or idempotent proiolem. ewhen form page submit button jg Cicked for multiple fim this frodem may racse: To prevent this problem toke reqesr method of Post and process that request fo dofest >) method with additonal logics: “This fodicales Post is oct fdemporent because fF Com prevenr doubk posting ty canceling # ab jhe requests- + the first web page of carb application thar Genes autornancally when reqpest iS given fo Useb application is called as qolome page or home page of web application 4p jova based web applications the him! er 55p Program? con be configured aS weldome pages Exi In webu) of Volerfpp web applicakon < welcome - file-l'SH> -+mus be token a5 subtag of Geb app>tag K Personal: nina! Personal. him OBC ISP $ile here. % weED Mo Weldome RIE 1S explicitly configured jhe jou. «eh applreanon looks to take ether fedex. jsp or fndex phim! as defaulr welcome Féle 2h both ane awailable the fadex: him)! ill be Faken a8 | defaulr welcome File: IF multiple welcome files core configred then the web pplication, Picks up one weltame file based on the availabiliny and configurah order KIFf all explicitly anfqured welcome files ame not qwailable and / foden+ pi) or fedex: sp RIES ane available then Week application Tun without weleme file »2 90090990006 geeeeceoeooos one 20000 eenccooceoecsat > oO OO “ ¥ a Pad IARI ERE ITS q A y fies of web can nok Gookigue frogram OB we nko can be placed in H ) n o 9 9 a Ceoce ccc cc eres bio) a : ea of tor cook folder. while Go figuring these bho! files oS catame Ries we rust specshy tha folder came voles a }— (968 DOF | ays. ——+ dasses [paces het 3A web! 243.) OBC hm! 1S < /velame- file> TO make oor sevler program able jo senvier Container, the Jouve Cass must be dass cohar happens tf ZT place Ly uae pattern of Servier Program main¢-) method relakd Jove class @) servlet prego execukon will be taken through life cyle methods cf servier Program So fk willl Poh called by servlet Container: only Since mosnc-) in ove seevh cone by Serviet visible ard access— foken 5 Public ler Peegram? Gotainer TS “Por the life acle metod grond alone applications te need main (-) method 0 begin Ihe. egplcaticen exe cuton. The container software managed program! oF Components will 22 execu) through reathed 18 sok required on Infe aycle methods Hak Gmpenent& 9° Grogeama (8 BO raoint-)IF prograrn is exewtiog without moin (2) roethod ? a P) The oo opplicakon thar wil be executed bY..7 vm “directly : reed2 ‘© fave min) method 1 beglo the execulion. Since sever o€ program is ek Stand alone application and Te Ik a web resource 9 _pengrom which wi be excculed by Servier Gontouner through li acle A iethode go there iS M0 Need of man (-) method fn Secular proqrarn. # If already running Sauer ofplicaos Gonis to create Certain offer Jove dass objet and wants 10 call meltode of thar class then that otter class teed mot baye moun G) rnethod » gegervierGontainer 1S a GnHinucutly rvnning javo applrcation/ sofieaxe ahi, creates our servlee class object and cals li{e cycle methods on (tar object for executing servlet program: So our serviee Program need nok fo have main C-) method - NOTE! Since we never give ovr servlet Program +o gm direcHy for exeuikon so fpere jp oo heed ef Plocing main(-) method in our pp Servlet Frogeacn + we verifiing the Pattern and formar of the form dara before tr 1s geting used tn business logic a8 lopet values is called a5: form valt_ NAM AL dattons ond logic writen for iis iS called OS fonn validation logic G Emi checking whether required componerne one filled UP with values or e nots checking whether age wlue 15 given ag numeric yale or rot, < ae : o checking whether email id is paving ©, + cyte or rot. < wror 16 the difference behdeen farm validation lqic ard wsiness [ogi (9) Business logic Uses He form data, o8 fnpot valugs and gancrates the eocenooceeosoooonoegoa0NNDNCIO of the fom dara. ‘ EXE! checkicg Whether Ob values ANE fyped or not and checking by Whether they one typed af numeric Valuez or ot comaé under fom of vasidetton : oe Performing Czatb eperaton Genes Under business hic: © ! i | resull8 where O8 form validation logic verifies the porkin and formar29095990 o ° 9 oO ° oO o ° oO ° oO oO ° oO Boece ce ce £2) 4 checking Whether Username and password volues one typed pot Gomez under form vaidakvon “ke checwing given username ond password values against db s/w, Username or ol password detailz Genez under business legit Form validaiiong tn webopplicakions Client side Seever side, Use VBScript code. or twrie, Java @de tn serviet/ Jauo script code fn form page JSP programs before, blogic. “Since serie code tar iS embed with form page execuks by Gmi to browser window we can say chent cide fore validations ane, good Gorepare yo server side form yalidakiong because jhe chert side form vatidetton redocas nekidork round fips behoeen browser window and web server. * Since there iS o chance of disabling script code execstton through browser setiog& fk iS cecemimanded to carite blk client side and sever side form validators 20 that there iz a goursnke of Performing server side form validakons even Hrougin Client iolerner oplion’ —> security tab —> custom leuel > Scripting > active scripting —> disable +A pekscop navigator Edit —r PreRerencas —> Advonced —r scripts # plogin£& —+ Enable javo. script for Nawigator Cdeselet) R retuen stakement without value fo any java im a. Hye Golrol from current wetted definition and further Stokemenrs fo Hhor meted defatt'os wil rok be executed Mg¥ For example application that Perform both Client and server std, form validations refer Supplementary hand out of given on 13-10-21 ; ‘ “retoro valdale (this) "> oO 4In je obove stolemenr the stern key word rakes ihe return value 4 of validate function (true or folse): Wh Ie 18 tue the tno ond © wes-tne 1+ personal: tro! ne F—9 my File + ] ee [oer cos VolerSrv- saya. Per sonal: bre} SI-- form page --> Ssertpt language =* JauaScrtp’ sre eceeoeecoecoeeormoeneeccocoel oO ° 9 9 oO oO ° ° ° oO oO o oO ° oO Ceveccecece wy file- 58 fonction yolidate Cfrm) § Prefer bond out code fa vaticate c-) # The Gde that can not be execuled fodependently and tr must be erobedeled abng wa with other technology based program js callek as script Gde * Towascript code can rot be execuled fnclependently ond if must be embedded with HTML Program for execution. so the Tauascript Code ig te olifference bewen fava and Javascript 2 1S 60 way related cif java Too. Towaseripr te re rip lors cege given to develop oll kinds of applications §— for form validations and for other operations: * Tous opplicarios ade can be F Towa sriph Code mast be embedded execuled Independent ly with bhel Gade for execution KWeeds IRE/IVME for executvan, R Needs Tawa Script engine forexecution wTt 18 object oriened language #it 1B object based Jarguage. Public class Test e Public void xc) 6) c YO; (ce) 5 public void yey — 2 a 11Dpublic dass Demo extenole Tesh 5 public Void YC) t @ 4 Demo d= new pemo td; d- 40> @) voderstandteg foih0 ye _foit(servlet@ofig this cg reg: Mtomializanton lege of Servier@ofi¢ obj lotr ©; 7 public void loft ©) emply method t 3 pyutre Sevleranfig gerserlerenfeacr f aekxn cg: 3 = other methods uy MOTE! ay prede fi « 0 @ on efinecl HEP Seviet class there o7e 00 fatkC) methods TestSev: Jour Cour Servier Progrom) Public class Test&ey extknds Generic Servlet /HetpServier 3 Public void torr 0 3 > Progerwner choice tniialiZakon leyic Ike crea 4 Goonection obi ecrecceeeecccsgoe@eoggoogcooo nose aecosonsas39009900990905o po o oO a ° oO oO o oO oO oO Ce ceocecec poolic void Service C SReY rev, Shes res) Hrows s6 , Toe 1 © request processing logic a ‘when servier GonFainer raises fhstankation event by Createag our server class oaject then contacner callg Toft C-) melBod but nok fnft () method Go ofr) melbod 1 called as lifecycle method and init ©) Mmethool ja nok [fe ude method- 4 With respeck 19 the above Code @) End user gives first request to our servlet prograry @ SerwletGonhacner crealtg our server class object CTestsrv) ond also creakeZ one serylerG@nfig object. @ ServierGotainer call fork (-) method 92 life cycle method by feapiez servier@nfq object a argument value, on our Servier dass object (WD Sioce fotkC-) 18 cot ovaclable fy our Servier prcgrarry the SuPer Class (predefined Grenericservleh class) fot) method executes (5) The super class foft(-) method fnikalizes tee received Servier@ohg ORK In GenericServier class ond calls fa?kO) method. Since farecy method i2 avotlable 7 ou Servier program that will be executed Here programmer places hiS serviek program related foi ttaliZahion logic ©) Servlet Corainer calle rexr lifecycle method called public void service C-)on oor Servlet class object. MOTE! Zn Scenario G) programmer need cot to Cenkig ebjeck explicctly fo his Servier program: more ever we can cou gerServierGoFg © method te ger access to servietGnfig object From ony lifecycle method of his sarvier program» Sc eratio @) Generic Sewleh Gouro- Psat 08 abeve ale 10 scenonia (d) tclwbitc @bsiracr dass Generic Sevier feoplemen'S Servier Servier Confi'9 99> public vod fotr € Servier@o9 <9) F niseege as foth 07 a public void fort ©) { 3 carver Public F peurn ga; 7 > other memos 3 frother meth a @) @) eStSry. java, Cour seevier prg} Puelic class TeskSry ewend? — Gieneric Servier /Htep servlet 4 Seevler ok 09s public yord torr ( Servier@ofrg 0g) bw ARis-cg= 69: = Programmer choice tniklaakton logic like creaking — Sdee Conneck'on obi J Public void Service CsReq req, cRes 25) throws SG, TOE ie ——— reqest proce ssiog fogie 5 a * Here 1, @), G) aNe same as gy 5 ) Public servlerG@of9 getServlerGonfig (> nein 8 4 <= Fother methods 45 Te stsev. java. (our Servlet program) Oy Co Ole Public dass TestSrv extends Hcp senvlet/ Greneric Serviek 4 public void fat (sevierGanfig 09) gow 25 W Fragrammer choice inital zakon lagic like create jolec connection super fof} ©) 3 Prone Void service CservietRequest ct, Servlergesponse tS) thems an, ree 1 6) eeqpest processing legic ny(0, @).@ sees of SKenario®) axe Same af 7,0), SKPE of sceranu’ ) thik C-) method of our Servier program eaecutes © Gecouse of superinit Cag) method call he super dass (Generic Servlet) Tot (-) metnod executed 6) folk) method of Generic Sevier class iholi3es the ServietGonfg abject Cortasng Servlet Gonfig — fnittalitahon togic @) since init ©) method 18 not awatlable in 00r Servlet Foire) matted of Genericserviet class will execule- @ same of stpG) of scenario @) NOTE 5 method coll fo ger ServietGonfirg object - i) 2F Programmer forget2 to call super. tnt (ca) method the Service (~-), destroy() Tfecgle methale con not get access to Servierantig onjeck even after calling gerServierGonfigt) method +t The besr Scenomio fo Keep foi C) method fn our servier prograro 12 Scenanio @) Coverriding¥ jotted method) pluayz give chance +o execute fofkC-) method of predefined Greneric_ Servier Class during ou servlet dass insronkahton and fnitaliZahton Process: Becowse #hi2 method conkaing cervler@nfig foikali takton logic ard makes Programmer not performing that works eeph ‘y wry servlet OPT has give methosl when fr iz rot Iivecude wethod 7 : > Re Rr the 4 panagrophs of fit) Ye tote Csenvletcanfig ca) discussion of page 00-55 of bookler. +9 Sood senile programmer always overrides int) method in his Servlet Program fnsicad of fot > methed Cfotiow Scenario 9). x IF class methods and — super class Public / protected rnethod2 in Suts loss can be called withour object 29900 9e¢00C090095 2909 eceseccoeecce 7 O0eoe20OO50"Meo cece oes Th ony We cycle method of sevier prgrom Th ory NE NS ez Servier Gon Fig cg = gerServieh@ofig 0; gives access fo Serviel@ofg obj ab ts op mathod of Gienenie Servlet class 29 iF can be called with out olejeck tn our servlet programs understanding 40. Service c---) methods and seven doe (-,-7 methods of Predefined piekpsevier class we can use one of the hoo service G-) methods or one of the seven dokexC;-) methods fo place reqwest processing losic ty our senvier prograsn but only public servicer) methad 15 We cycle method ef servier program a —r——C—C public absirack dass HetpServiet extends Generic Seevich public void service CservierReqest red, ServierRespanse) Htraws Sb, TOE & 1 iype casting heepservierRequest hreq= (WetpServierRequest rey) lcepServierResponse hres> CHetpservlerresponce)res ealls protecled service, -) method serviceChrey, hres>; 4 Tproiected service c~/-) | seeicac-r-) method? PrOHeceD void service HttpServier Request heer, Het pServietRegonse hres) re dheows SE, TOE Peeads fhe rewesr method of given reqpect Siring method = req: 9k Method); Ucalls ene of 4 dokse(-1-) methods based req method (F Crnetned : eqnsals C~ GET") docet Chrea hres)/ else if C method: equals(*Post")) doPost Chrea,, hres): else if Cmethod + equals (*head")) do Head Chrey, hres); 1a37 Prokected void doGek CuttpSevierRequest brea, HetpServiet Requesr hres) Hows se, TOE = loge send yos error response. fo browser windod Protecied void eloPost (Heipservier Reawest rev, HerpServiet Response hres) Throws $6, 106 logic sand yos error response to browser window Diraplementation of ober doXxe(~n3 methods Sending 407 error response 40 browser windlout Aedass Te stsev:joua Cour Sevier program) eee ee a os @ Public dass TestSey ewtends Hetpservlet Public void doGek (Hep soVerRequesk rea, UEIPSerylerResponse ces) ——— ow requesr processing logic wilh respect 40 above code () Arenr gives request Yo Ur serulet Program having ‘get’ method (2) Servier @rpainer creales 6r) locales our servlet class object 1¢ created SerVier Container a)50 comple3 Ye Sitio ZaHon process: 13) The Servlet Goburer creaks ServiehReqwest, ServietResponsé objects for current request ond tolls the (if cule wethod public Service oo0e00oes 9090090999093 neereneoooors DSOOCCOOSOOOOOS» dass object: keeping SonvletRequest, SevlerResponse objects as apgunent > volves + (W Since public Service(--) method is nok available tn our servlet program, the super dass public Servicet-) method exeuules Cpredefined WbIpservlet class) oO This method Converts ServierReqest object fo HtipSevietReqwest object, SevierResonse objec jo HetpsevietRespase object and calls prolected sewicee-, ) method having those objects aS anguments: 6) since protected Service(--) method 1S mot available fn our servier program, 0 the prolecled Service C-/-) method of super Class (Predefined lttpservler clos) exccule®- Th'S projected servicet-/-) method calls do Ger) meticd based 9 on “get” method of given request (@ since doGiet(-/-) method 15 available ft our Sevier rogram tat will be oO executed and generated response qoes to browser window NOTE? Dork let doxex(-r-) methods of predefined Hbipservier getting exccuted dtceckly @r fodirectly, because Rey send “4os' error response to browser © yindow fedicoleng that our servlet is Incomplete servier program towards © Processing request - © pwwhen reqwest omsival event 1S ratsed (means request Gomes fo Gntainer) servlet container calls public service(--2 method on our servier class object © and TF never calls profected senvicet:-) method, doxec-) methods for thar event so only public Servicet..-) method iS called as servier life ycle mettrods proieckd serviceC-,-9 and dotexc-1-) methods ane calleal Convenience, methods given Jo progrornmer fo Keep request Processing logic to our Servick “) Pregrarns: YD -Rfor understanding flow of execution th our servler proproms towards vu the request processing refer the Six stenamios given fh page no. 86 of bool + Regiskering web opplication in ONS egISWY iS nothing bub keeping’ domain name cf web application along with home page URL the TSP machine where ever webagplreakon hosted will te hauiog stake/ fixed 2p adress fence we purchase space from the Server of Tep machine they supply Ere application olor with user aome and password “and we can use, thor Fre application to inkerack with Our Space of TSP machine from ony place 90 using nis %e host or move web applicakens 40 the server of TP machine « Flow of accessing @) End user Yee — domain nome as UAL in browse Windows odes ban (lo) Through infereel nekwork 4h2 request goes jo DNS regishy, gathers home page ceqesh URL of ven domain name. (KC sata cn) fron DNS regishy (@) Based on home page reqwesr URL fhe web resource Program of hosted web applicakon fh tomcak Server of Tsp machine will be executed G) the web resoures, prograr generales one web page to browserwindo? FW can add BF remove web resource programs 9 jhe hosted website of TSP seever fiom eur local machine. through FTP application. (This is nothing but updating web Pages Content aftr hosting) ives”heep requesr methods ast Post Heo ewer puT TRACE oprions The regulary used WO reqwesk methods of ceal world protrrenig Gre get, fosr ger: #GIVen to gather/to ger more dole fom the server the cesponse of HS method based request Contains both headers ans Sy Hea Head: ¥Sorne as get bur his method based request Jenercted response antains only eesponce headerz- KThIS method if Useful fo check He avoslability af wer «esource Programs. NOTE! GetC) Method is Usefel to gother doko from server by soning limiter amount of dora Cupto 236 kb) from the request: #DeSi9n 40 send Unlimited amount of obra along with the request puts yuse ful to add OW web eeSoUrce Program fo Woh apelicaron from clear delete tuSeful 40 remove WebreSeurce program af wel application from cleo More? pur O, oleleke ane Useful tn the olevelopmenk os ETP applications. opkoos server delenines USIO9 cohich request metheds the cLirrent web cesource progeam Can be requested: Note: TE oor server Program Gontains docer() method overnding then the ophons request mithed based eaLeSh given fo thar Sevlot Program 22eco0900900 a¢ eoococscoo ecorcoceccec«Go celoing ger Head. Trace, apttons oe RO Trace request metro! based request deracls of contazn web reSource Progra can be Used for debugging operakon# List of frm Components fn form pope eae eee rex Bow Q) Passuora! Box! ©) select box./ ComboBox © List bow @rearhren © Radio Buitaes (2) check Bow Seols the Flow of execution like server. So these details ©) bolton (Stondand button, Suemit button, reset butON) @) File uploading component Ten Boe tle form poge Name: 3D Servlet progrom Cfo cead comp value) String st= req. get Rariamekr C"Prame")} Password bow ae form page Pe: < inpur NPE =*password™ name.” page”? Jn servler program Etrieg Sim req. ger fonameter C'page"); exr Area inform page Address i enke ur axdress lotBn servlet Program Cto read component vole ) Sting siz rey. gerPanameter (“taddress’); Select Box (combo Box Callow US to ereaiey selec one jem a time) Qualicoki Gicohon : < celecr name =" alfy"> 8-E/BTech option, MBES C/ophoris 2.0 f0_servler_ program String si = req. get Rammetrer Calfy"); HK ebile workerg colt Select Box the celeded tem will rot come fo server aS requesr parameter Value, Ihe Valve available to the value alleibuse of option Fag for Sdecrd fern will come 10 Server as request parameter valve: {41 from the above Select tox if Bé/tech IS choosen then the valoe 2999 will 90 fo Sever as repest parame yalve List bor (allows us to select multiple tems ata Kime) eres eee! ati ee Inform page Courses: NET pKa envler_pregram options String SCI = req: gerPorameter Values (“erst); x TB 70WA PEG, «NET PEG ims axe choosen then SCI holdes 5 . Soe eS elementa values ee co0@ececeoosososecoaect eccerroooec:9 9 9 9 © oO oO oO oO oO oO oO oO a ecocececoce: Radio wins Ee giieg some name for rultigle rasio butions we can group them untk: So only 002 radio buHon can be selecitol ar o hme: folo Single sin_forn page Gender: mole fobsp; dobsP; Femole ln Servier Program ghing siz req-gerPomameler(“3") } 7 gives mM when male cas is Selected M9ves — when female casio is sHlectesh checkboxes, pushen multele checkhxes ane grouped cto Single nik by giving some nome then We can select multiple checkBoxes at a time a Hobbies : Reading Jove wets —r web applicalion + meer —> Proje Name : [focmoep peek —y server: [elastFch 2.1] —7 neat —? Finish SEP@ ggg form poge fo the proyect (Details. html), Right click on webpages folder news —> Hemi > fy1me file nem, - Pioish peoesoscecocoerssoe9gnocce0¢30607999007 ¢@neoroeooeccoO oO a oO oO o 0 oO Ce occ ccccc. cform actions *for\* methad > “92> oe! pares Sf Formsey Servlet program Home: ce Age: cinpur types Vea” Dome *PORED siiey Leos, eb/R ech spun Pls MBBS &-A B-se reading 4nvsp; 4065p Rooring EnbsP: 4nesP sleeping Kidz Address Slext area, name=tdress” cows= “Y" cols:"20> eniee addieess chp < inpur types“ submit” value ="getdetadis’ /> ¥ merges Iwo Cells into single cett Shep |: Add formSrv Servlet 10 Source packages folder of profect Bight dick on Source Podeages folder —> naw —» servlet —> Class name :[RormSev) —> neer —> vel potiern: fur) > Finish 1OTE: The above TPE generated servier Program Gives ProcessRequest<¢-.-) method 1D progrommer for keeping request procssing logic ard this metmod wil be adlled nkernally from doGet (--) , doPastt---) methods tke efpeaach (3) of developing our Servier program aS flexible servier propram (Re Fer approach (3)) 2) a 19090930 a200ecseceacs3 »Ceocococoosn eeseceocootes:ecc cr peec a. us keep the following request Processin? logic f0 frotessRewest-) Seclbed =f oboe ce hee Pgenerad seriegs Printeariter Pus reS-gerlriterc) 7 eS: setGntent Type (“teat phn” )+ weead feorn form page String ame = req. gerPanamey (“Poome’ ); for ages Foleger: panselnk( ref: gePonamerr (‘pag 9); Sing gen = req. gerPanameler (9°) string Yfy + ren get Ponameter ( “a1 fis");, String SCI req: getPanamelerValues (“ers"); Steing heC I= red: gerPamameterValues (ch I") > String address= 029: gerPoromeer (*toddress'y; iF (gen equals (“F")) 4 if (agec:%) pw-printin (name +"U baby girl”): dse if foge<=12) Pu print (home t “Ue child giel”)y else if (age<=19) Pw .prickin (name +"Ur teenage gic"); else if Cage<=30) Pw.printin (ramet “ue a. yang etamaci'), else if cage<=45) pusrprintle (name+” or middle age women); ase purprintin (name +* Ur old fady"); ss else if (gen ewals (*m)) i ig coge <= 5) purpeintin (name 47 baby poe); a (+4Bokece \sivearn oh pernrciasaGy G S ypsor fern datov a Pw -peintin(’ age =“ 4age); oO Puxpriotlo ( Address =‘ + address); 4 pas: Priotio (" Gender &* +gen); pwr printlo (Cebrp Qualification = 49) F 4); Pw: printle (Yabr> Courses ="); For Ciok F: i< crs-length 5 441) oO i - Prprintin Cees CII4"....* oO 4 oO Pu: priotin (“ hobbies =) 5 ° 3 Gor Crok $203 I< he: lexgth: 441) : ; 0 Pur peictlo( heLEFJ 4%... “); 3 c blo se sleeor obj 2 Peo close C) > a oO 3 oO SHPO) + Run the Project . Right dice on FormApe Project —p Run : we can prepone wer file on deployment directory Steure of web é ofplicakion Each wom file repre sent2 ene web applicakon ‘ Procedure to Prepare won file C eee eee ee a on - 7 PPPs e — ow eeree 27 ° [> vorer Ape = —— fe ° WE8-103F - ec c j > classes > perguist bin! ' eee 2) . | coep- ren > myf aso sou) ue .© oO oO oO oO oO o o ee To prepare wan file eS @4ps\ vole Hepp Jon cf Vener. worn - Gives Wor file by Canbining everything of Voteraep feller. There ane 3 ways #0 deploy 2b applicokons jn servers Chord deployment Copy wor or directory of Web applicator to a Fined @ insallation folder af server soffeaane Jive Tomcat.home\woeborps foleier)- @) Console Peployment (use admin Console window for deployment) © Tool based deployment (Deployment usieg Ie0lF like Ant, owen, 20 +) is cedommanded process Procedure to deploy webopplicooo i> Temtor Server through Gonsole_déploymar process Step) 1 Prepare coor Fle CVtApp.war) as Shown abwve Step @" Lownth “Tomcar tech applicakes manager window stont femacr Server —p lawnch home page —? Temcak manager —r Subir user name password BPG): peploy the wor File coment web application manager window —> Selecr wR File 1 veload —> browse —> saleck the above vere. evar file —y pepley *Test tre opplicahion by using the following request UAL neep! //locolhost : 2020 /yLoee [personal htm! ve West file Mame a8 Context path ore: 3 NOTE! In mwst of the servers when umn File is deployed, ita file come whomarcally becomes Gonlext Path of the web application # To perform bard deployment of web application fa tomcat Server copy VolrneP Rider a) YEPRP-eDaN fle to fomeat-home\ webapps folderweblogic jupe + GpplicabonServer Siw Vendori BEA Sysiems CoracteGerp) Version: fa3 Cdompatable with jdk 6) @ermertiad Sa defoutr porr 90! Fool Jon File hak represents whole Jee para apiz . weblogic: jax fo dowsload sofkoane : www oradkeGom 9° wWUW Commerce -bea+Com for doc8: wun: edocg bea-Com or wari’ oracke: Com allows to create domotns . each domain act as one opplicahion server. KIP roulkple projects of A Grpany ere using Jnen weblogic Sho will be installed only once fo a Comman machine Lor foe multiple Projects mulkele doraing will be crealed In thar so posedure 1 create user debine denain sever in weblagic 10-3 Stoat—> programs —» oracle weblogic —t Quick stark —> Ger stonied with weblogic Server —-F create ned Weblogic demain 7 next —> Grereate a doroato oer pemein name. Adv Java BakchDemot “= neak 9 User name « [javabass) password ‘[Jovebasst] Gnforn uSer password s [pewabess —+ nant —> Selec Adminshakon Sever —y oer —r Listen port :[ ora] —> neat —» create pplication Server = wxb Server ETB Gnrotver f middle wane Services 0052990G09909099995995 70090 eacsoanaeceoecercoecocogegeepplicaKon Server semgene | seourtey [ee Gon pooling | coonieg J clestering Servier Gontozner Tsp Coohoiner EIE Gontouner REI s0eh KEIR Cootammer iS required Jo manage and exewile 78 component Wor file —» webapplicalion axchive Creprasents web applicoivon) * Jon file —>Jove onchive representa java api/ ep File) + €0> file —> entiprise applicatton archive C Son File+ won file+ jar File twanfilet---} Kram file —presouce adoptor achive ( represents a fee application jnlerceting with srebel/ sep so) war 1B the difference bekween webserver and applicalion server? web Server opPlcation server (atROwS to deploy and execute web (9 Allows Jo deploy ond exeqwie web eeplicakons, 63% Components. Gnterprise eppiicakiens and resource adapkr offs: opplicakong Q)Developed based on servlet, asp apr (7) developed based on all gee api Spec FreatigaS Goves senvler Grrainer, 1p anioier. — waives both sevler Grtaine, ip Grtairer ord ESB cintainer §) Do|sH allow 10 ertare domain W Allows 40 creole domains © Allows oly Http proieat request © Allocs# both HELE and nom Heep Crop, 73 ond ee) protoed based request © Atves minimum oo of roigdle wore PE GIVES more no. of Inigsle wore Sonica s, services: mi° @ cvitable for smell stale and medium @) suirable for fage sole webs Scale Web appltcakons appltcaktong anol for TES applications. o @Recagnises -wWar Fle as agplicokon —@)Recagnizes -wor, cor ejon,-ror CP Files a@ applicakons @Er TWS, Tomcat, Resin ond erc. fd Ex: weblogic, websphere ,Jeos¢, Glass O Fish and ete s Procedure to perform the cnsole deployment of web applicakion Advi bat Hf a Weieeel en a SHPO: frepone wor file representing your web opplicaion tike Vtppp.wan 5 SHPQ) stant Adv jauoBatchDomein sever of web logic. refer Fee dass . Sram —» Programs —r Oracle weblogic —> USer praject2 —> tavabauaselcroonning —? stork admin server for web logic 2 SPO oper adminsication console of ihe above domain server GS open browser window —> type below URL 7 http: localhost + 3049 / Console a vsername: javaboss 2 pasesord ! sovaresst ° SPW! peploy the Web applicakon through admin console 3 °o Admin console —> envicorment —y ger Deployment —> fostall —> upload your to FileS—s Deployment achive —s Browse ord celcct viemp-conn file —S ou net —p ner —> nexr —pnexr —> finish —> save wrest the above deployed web application Admin Console —7 deployments —> launch veerpwor file —> Select personal-hm| File related URL (1 eedepley the Web applicakon In web legie Admin Gnscle—7 dephuments —> [EB VEArP — ciel ees-cecoscec:edD “To perform hard deployment fo fAdv-javeBatchDomain of weblogse secver copy webapplrcations directory on ite Bar FIC 4 oracle weblogic CYolereep) cvmrr) home \ user. project? \ domains \ autodepley folder * when wor file i wed for hand deployment CvefpP-wor) Use the following request URL Jo Lest the application. i) @o) a) 2) 9) 0) @) ete: “localhost : 3070 / Vener / Personal = html * The web application thar ie deployed in weblogic server trough 1) hand deployment Press can sot be undepluyed from admin console. but con be undeplayment through hand deployment process itself, O when wep application je hard deployed fn web logic server through direao- 8 ry based hard deployment Ccopytng voterArp foller to autodeploy folder) then O vse following raquesr URL to test the cpplicanon > > he Lp? /Mocalbast + 71070/ vetec app! Personal: bree)! oO 7 oO Directery name a8 Gontexr path ° FIN uxb logic server when you modify the Source ade of Servier O Programa placed in deployed web application, just oompilakion is enough 10 ger the effect of mod Firakons and jhere is 0 need af performing Othe reloading of web application ~The web appiicakion and jr Web resource Programs ifab ane pons rlolve URLs i= called a LwoDA applications - ft Gach server Suplied Seperate implemertation classes implemensing \eovous 2 foterfaces of Servier, ISP Opis but we never specify these implemen oO iS tation class names fo our Servier programs to moke our servlee Prog roms ws oS wore programs - v 4) Glass sh ; = type: Application server 5/0 : Vendor! sum revere sy shen S Version. 2% Comparable wit Wk \-¢/15) vu wtopen source s/w Bllows to (reat domains: pefauit domain is domain} Jom file thar represents all Jee opis: Javaee-jax defaulr port no: gool Cfor accessing web applications) 48U8 (for accessing admin ansole) The Glassfish 2X softwane thar Gomez with cebBean® 6-F-1 Toe can be Used with or without IDS Procedure fo charge ihe default ete probes! service elated portno & doman! server of Gdass Fish 2c —EeeEEEeeeee Go to Glassfish. home\ rep Server domains \ domain! confi9\ domain.) File, and change fork ottribuie value of fiesh bog Procedure to perform console, deployment of web applicaiion tn domain —______ — amr’, SE lication In dorains Seever of Glass Fish StpUD! Prepaning war file cepresenkng web opplicaton lice VERE war 9: skanr domaini server of Glass Fish toa —» Programs —7 Sun inicro Systems —PeRplicalton Server—> stant default secver SHEPG)? open admin gnsto Console of domain! Server open browser window —> type het pI / localhast : 4848 usec eame « [asain] password Sladmin aaein] sep ld? peploy the web> application Admin console —> apelicahions > web applicakions —> deploy —> type :[ Wee applicaren CHa Ty beaten: srowse and selecr VEARP: WAR —polk 5pSY Test the web application open the browser wird — type below URL http! //locol host 5151 /VEORP/ Pecsonal+ tre | wan file Pome as coolest pakh _ a a eocccu e090 osce ccoces eceectbecooogc.SSCSOESOSO SOLE COCOSCOODOODDIIIDIIIIIHIIIIIIIIIIIIIOD Hethe Glassfish server support only wan file based hard deployrnent and if does not support directory based hend deplayment. Procedure fo perform hand deployment of web applicakion th GlassFish 2-« Server: Slept): create wan File representing jhe loeb applimtion (ike veAep-w0r) slep@i stant domain! server of GlassFish Shoat —> programs —r Sum micrasystens —rAnplicalon server —> stant default server: SepG) | pepley the web opplecation cepY the above Vknppwor file 10 GlaSsFish_tomer\ empserver\ Domain SS domain! \ avtodeploy folder SKEW): rest jhe opplicorion open browser window —r type below UAL. beep: / locothost : S151) VEReP I Personal: hin) + Wan file name aa cone goth “Euhen fore page suemir button is faken with logical name then the, caption of tne emit buon will go 10 Server as reqest paromeer valve olhercise Submit button capion never goes fo server as requesr parameter vadue- Ainpuk types" Submit" nom gloput types * submifY yolues “check” > SI foren> Neve: vere relad fo Submib buten ro vale wilt Pooorreler value - 90 b Server as repest ASResolf Result 13 6-10 reste issace | is: 30 to handle the above form page celated request Processing give Some name to all the three submit buHon& with diffrent capkons and use thar caphon OS criteria value tn Servier program fo differenbale request processing logic’ for €adn Submit button: foen = hi) ger’ > B value: ; dead form data fok a> Toteger-panse nk ( request.gerPamameter ("bi") ); for b= Tnteger. panse tnt (request: gerPanam eter (tay); meead caphion of submit button Siving Cop = requests gerpanameter (*s\" i Cea: equals (“anid”) Pu printle C sum fs en result is” 4 Caney RO-Printlo C add bin 1s clicked"); a else IF (cop-equals ("sub") ) ¢ perprintio ( result js : Pu Printlo (° sub bin is 3 else. 3 PO: Printle Cresut 35:4 Co/by): Purprintin (“div bin 1s dicked”y; 1 Jelose. Skeam obsecr pos-close(); 3 a Web + x0) configure TeskSev Servier program with gebyeon age -bhol (static web fom gerpate —_| + Ca-b)); licked); crestere! sTestScy (server fray serine | 4 FF! Hordtiog with moltple Hyper ok PayPage-hhe) foam aettory=/” cer> Qed Stig cbr? geritme Calendar: gerInstance() Thre gerTnstance() is Shake wmethed of calendan class returning one Sule dass objet of calendar dass ag rebum valve. Calendar dass iS an absteact elaSS- KT, tre above Statement cl is mb the objet of Catendlan class th is one svedass wbJer of Cdlendaw class. —forreshtra| Treat patiern of FestSrv Servlet Prearom A value B value getSysdale TeshSryjovor Public class TestSry extends HttpServier : 0) Prokecieel void Service UbepSenvieRawest request, MbtpServierResponie, respon Hows ServierExee pon, ToGucephoo Wqererol) setieg® response: S-Goterh Type Cent /phol*)i Printweiler pws response. geruariiat?, Jeead $i ref, poyamerte value String puals (equcsk. gerPanameter ("51"); More rey. processing logic based on hyperlink or submit fiputton en that iB clicked 1f Ceval- equals Cadd”)) wif add vin js clicked t fread forn dota: tok Oo = Integer-panse Ink Crequest SetRon ameter (*t/") ); inl + Foreger - pansecint Crequest. 9b Parameter (“3° )}; pur printly (sum 132° 4(a46)); i else if Cpval equals Ctinki*)) IF — hypertink is cliched i Dae denew pale (1; Pu-printin ( Dake ig 4d); y (close Streom object peo dese05 CeCe eceooeeosccoeeee08600000000900900999909993993cee. 9000035590 ceoccooooqooors Cecece ecoece web-0} previovs applicakton identified through it8 URL poten accerding fo There 18 a possibilty # same OF ee Seviet Program is senior specification gE by Sun mior SySlerne of giving three fypes of URL patterns WW) Exack march (2) Directorymalch &) Guension Malt Exactmatch p URL pattern beging with 7° symbol and Should dd Gaohain # Symbol x multiple fords can be there fo the URL Palen seperated with °/" symbol Bx, In webs /iest | “url patterns request uRis from browser wirdlow) fo requett jhe ahove servieh Program pttp:/ localhost: 2029 /polenep/ test (valid ) http *// local ho St °2020/ pak.Aep hyd ESE! Clovolret ) Jdakeep/testi/abe —— Cinval'd) {rast APP Jadee 2. Govalid ) x0 curl ~paHtero> /test{/ abe SB) fae /lest/ 2% 228) rest. cpp The uRL Patten frovided for servlet programe can hide the Servier technology ond the class names of servlet programe fram the entlusen? of the websites THS gives TitHe bir prevention fer ucbsile fe website feom heaccere and jackera» —fDirectory Makch The URL pate must begin with "7" Symbol symbol and cen also fave multiele words seperated Exu) s Hest( (xyar/ * request urns fom browser window to request the above secvier fregrom . pla oe i paca ree peep: Mlacainost :1020] Dakepep/ fest faye. 1 /abe Ppaserep /xyry/ jest) / ose ord must erd with % with 7” Sgrabol - (valid) Zrarenep / 36861 frcys.t / obe-< ¢valid) [rareAeP/ oxJy] test do Joosenpp/ lest! (ey 21 7¢babeanep /}esty olfer example diretodymatch UaL patterr eati< ucl-paberny X14] # ends: cucl-palen> Jabe /aya/* + abe O Ge Bi Ka oO O *we can rok prepare ORL pation ef a Servier program by ming ° up routrple styles because all servers ane designed fo jus recogrines 7 only je abae 3 sivles of unt pallens o /ay3 fobt/ #-abe ‘ v c Tivalid URL gatiern formation a Af fo servlets ane configured with Koo differont siyles of vAL Fo potieros = I"ke exacr march and exknSion match if matching same, Oo ~ Rquest URL given by browser window then Sever gives Yengackan priority © to exocrmarch url pattern based sevieh a o Example sceranto oO ‘In __web-mml oO oO Date sey ———? Bit esto ue patlere (exackmarch) Dake Srv ———> with /*-do uel pattem — Cextensionmatch) ree p? //ocal hast | 2020/ DaleOpp / test-do v This Hstdo matches boty paleSey, Dak Sev) Servier prograrn bol priority will be given to aecey Program wilh UaL paren exact mabch. MyBclipse = Eclipse + Built plugins fo work with advanced technologies * plugin Im paler sofware or Software opplcation Hat can etn ernane the forcionaiikes of excskng sw and Sg applications: Bin Jawa environment plugins come a& jon file: In toc soypoanes ply ine provides witonfe to dewelsp Sto technolowes based oplicahons ecccecececcescoocgoo0ng inwher id tte difference _beiween Eipse TDE and MyEclipse IDE? eclipse Myeclipse &) open Sourte, W Gmmerccal (2) Provide? environment io develop @) Provides environment to develop sé module application® 386,566 and f — based aplicatrong. 3) Does not provide bwilt-in plugin GB) ar Providlez uilt-in plugin 40 10 work wilh advarted technologies fork with advanad —lechrologieg we test prem supply them rmonually. and alge allows to add more Pluging expliatly. () suitable fer stall scale companiez - 4) Suitable for medium longe stale Companier Basic foformakion of myGclipse Type ¢ DDE Sofkoane for Jawa enviconrnent. Version: 8-2 Ccomparonle with dk 16) vendor: Edipse organizakon, Gromercia) sofkvare Seale. ond Govep tomcat a3 built-in Server: But alga allows the Programmer to Configure other external Servers. to download software ww: myetlipsesde- Com for decumentB ¢ www- myeclipseide- Grn Myéel hear code + Sub seriber ¢ goclo: Go Subseripion code: ELR BZ ~BISUYY~ 6666535737876 142 + ed giver based en cdipse Tne Proceciuré_to_develop below application by using mmytclipse 4 SHPUD' Lanch my Eclpse 206 Ly chosing one. work spate save the projecka work space: E:\mybclipse 8-% Wpse Geleelio, 6G Eclipse ane alienate Toga for mybclipse which one pe folder io preoscacaco9aDea2000090 enecooocccoeooexre0co0es ecoee Cccecccccc Formarr) Poem Sev(Servler ) SP@)' Submit the cheat Gee Myeclipse menu —+ suescripton fodsenatton —> Suoseriber = Bobseriphion ade: [=== SEP): create wee Project fo mysdlipse IDE —— Fish, File menu—+ New —> web Project —> projecr name: [Famaneel) — fiors Goiexr root vet: [7 Foemepps (ata SEP@I! dd form bil to web rook folder of the Peoject Expand Project —> aight clig on web root folder —r naw —p hho} > Filename Soren. ntrol © Stoem reethodd = "get" acton =“ furl” name = "FI" > Name: Geeder’ # bos server Program fo fhe scr folder of tte projec Right chick on ser folder —y new —y servlet Name: fornSev —> select doGet,doPosr methods —-oeu- —7 semler /T5P reopping uRL: / —> Finish SHPO) 5 In the generated FormSrv Sewlet keep the following logic ard call thar method * In Forney jauoy public void doGerC-.-> throws sé, TOE W general setkings response set@nient Type Clear | bral"); Priotwriier pw> response. gerwrifer (> > read form datar String name=cequest « getPanameterC“Prame” >; for age = Integer. panseIot Crequest. get Parameter page"); Shing 92n=reqwest. getPoramerer( “gi"9; if (gen. equals Cm")) . if Cage >=21) : Pw Peintin (Or rnamEe tue eligible fo marroiage") 3 else : Pua Peiokla Cmr +name+* ue not eligible to morriage”); 5 SMF else if Cgen equals ("F*)) : if Cage >=18) : 5 Pa-priotin (“miss"+ came + “Ue eligible 40 rmanrie3e”); 3 7900009009929009090 eeceorecooceccecoa0e0000nesgog000cc 00 coooococ eececceoece dse * puo-printla (imi ss” + nome ‘u + ook eligitle to manrioge’} 4 jyase if JjudoGer C1) Public void doPosk C--) rows s6,106 4 SEP) Goftgure Tomcat 6-% Server with myecl docet 1-05 Wse Ide window menu —> preferences —> myedipse —* Server —yTomeal —7 tomcat 6% —— Tomcat ——x Tomcat—home dliredory ; p:\Temxah 60 — apply rots SEP)? stant ihe fomcar Server fromm myStlipse TLE Go to servers fcon tn the feel ban —> Torncat 6% —rStant ske@)i peploy the above project Io Tomcat server- Go to deploy (con of the fool ban —¥ project Formapp! —r aud carver “omen 6%] —» [Finish] —> GE) SEP@): TeSk fre applicakon ‘open browser window —e TYPE thie URL beep +f localhost : 2020 /Forn one! | form -hhol J Procedure fo Gonfigure Adv-jauaBatchDomain Sever of weblogic 10-3 With My cdligse TDE: Window menu —y preference’ —T my eclipse —r Severs —y web logic: —> weblogic (0% —? © erable —y BEA Home directory sc: \oracle \ middleware Adminshotion username: Javabess Abin station pasucord; javaboss} 9aExecution domain root ? @: \rmiddle wane. \uSer— Project? clomacoa\ Ady. java Batch Bormain — epely —rokK Procedure to configure jhe domain) Server of ‘Glass Fish 2-4 with myedlipse IDE: 220099095 Lindow menu —> preferences — mycdipse —+ Servant —? Glass Fish + GlassFish 2% —* © Enable —> Home-diredory : Dt \ SunsPrPsever—z Oo peel —> ols: © o If mulHple threadg ane ackng on single vanable 6) obfect o Simuleniously en amurrently then Wwe say obsect/ vanioble iz 2 not thread safes Because, there 18 @ chonte of data aru O o pon in thar situation. c + To make He obove sold vaniable /objecr a3 Hread safe vse synchroniiakion Concepts. #Instanc yaniobles of cur Servier Program ane not thread sofe by default whereas te (locol vawables declared in the servicer, wethod of servick Progran one thread safe by default woser window (tI) web server Te Stapp web coplicakion Ker wrocer windowl eo) Browser windoces) ececscoeoceccoce pe@ng0coe’ooDn29905 e0000 -cc Coeo0coqco0gc. ecococaccec public class estSey exteodd HS 5 for ai Public void serviceC -1-) throws Sé ,T06 3 or be =e Jer, t2,68 One thraadl2 vepresenkog a : eomests + te above diagram the mutitple thread’ representing muttiple request of servlet program will act on Single Gopy af insronce variable “a” and every thread gets ifs own Copy of boca! variable, %’ 2, we “an say Varioble “a” ix pot thread safe ond vantable Bilis fread safe- * By defoult our servier class objecr and itB foStane voniobles ane cot thread safe- TO make them 28 thread safe, USe synchro- piZ.arton Concept ‘KD Store results. inputs of servilerB program io a perminant place pe database software e) to gaiher input values of senler progrom from perminant storage unit we need 10 make servlet program Inler ackog With dorobase software where by placing JPBC ade servlets progrom # Every TPBe Code Contains three important operations. Q) creake JDBC Gnnecon object (@ use gOBC Gonecion object io Creale offer TPBC objects and jo develop persistance logic (S dose 3PBC Connection object There ane three approaches fo place spec code fo our server Pr09 ror EPpcoach (1) @) create jdbe Conneckicn objec’ In Fatt (> ey use jdbc Gonnection cbject and other object fn senvicec-/-) /dboxeala, mettods -© dose jdbc Germection objet and other objet fo oleshay( roetbod FID approadh() the. JDBC Connection object must be decared as Instance, votiable So it 18 cot thread safe Cit is disadvantage) Programmer must use Synchronization concepl® fo make fre Conneckoo object a8 thread sofe- In approach) all PRE reqvesiZ given fo sevler program will vse Siegle JDBC Connection fo fnkracr wilh database sofware THIS 1S fopeove the performance - (ir iz adventage) APPrEaCh ea)! ©) Creale TDRC Gonnectton objecr In Service Gr) /doxxxt--) methods © Use JBC conection object and olher objens In service(-)/ doxex C-1-) metrods © close Ipac cnneckion cect and olber objecrz io service ©1/ destroy () melhod! Here =TDBC GNnMecHOD object 14 loca) vanichle fo serwice C-1-) reethod So tk ia thread Safe objer Cit iS advenrage) Gach request given to Servier program will establish one 90 Conn— eckon with database softwane. ThIZ KiliZ the Performance (Er iB disadvantage) APpeoach B) @) Ger JDBC Connection object from Server managed IDB. Connecti? pool neteg from Service ¢., > method / do %ex(..-) method bluse Jose Gnnectiom cojecr and other Jpac objects in serviceC/ do Xx (--) methods © Reom TEs Conneckion objeck bock fo JDBC connection pool from seevice (-) /doxxx (-) methods Hee Commecron abject is [col variable of secviee (1) method so iF At& as jhread sate epjects CE iS advantase) # BY Using Minimum no of JDBC GMnedion ebjers of GnnecHon Pool we con make more servlet programs and oll requests Coming fo eooecoccooescoco@eeeeooooNSoKNoeseO BOOTS BIOS NDOINSSOle bees ie en) 8 2 ie 2) 2 8 ee | oe ao servler Programz fokerackng with database sofkeane- This gives better performonce (@F jg also advantage)- 4 epproach @) ig the best for servier io database sofiwar Gmmu- nicakon + Example application on Servier to dakabase software Gmmunicakton Browser Window ___ web opt hire! (static peg) Pynamic webpage BE Su ermp (elt Fable) Deployment shudure when DaSsrv Program uses type! TOBC DBP > WEG- TNF ae ovat eee nay 5 1 eb 27) oe Desry. class then DBS Program uses tyre 4 (oracle thin) Jdbc driver oBere WEB-TnF ——+ classes input+ htra| > fib J+ ba sev: joua te ? DBsev + do. ss coe au) TealS when Stand-alone JoXa application sez 39 pay API (sther than o Tok pra) then the third panty APL reloed Jan files rust be placed fp doss palhe to make Save Gompiler and IRE fo rewmgnie and use Thied party OPL- #2F java web application uses ‘third portly ORL in tre wergewer resource programs (like Servlet, 3sP Programs) then third panty APT 290994535 relared gar file Should be added fo class path and Should ako be added to folder of wos application Here fan files added a Jo hss pai wil be used by Jauae 19 recognise third panty PPE during 0 the compilation of servlet prograro- Similonly Jor files added to wo-IF \ie folder wlll Ge Used wy servler Container to remgnize ond vse Hrted Panty OPE during the exetulion of Servier progran- @000csc Ex: TF servlet program uses orade thin driver then keep ajdbcit: Jor file to 028s path and wee-1F\ lib folder of web applicarion os shown o above #the jor files added fo cleSs-parh ane rot visible fo IP& Sofr— wanes ord fa container softwares of serverd Stand alone joneu application will be Gompiled and executed From Goremand prompt: whereas servier Pregrarn Compileken tees place fo Servier @oraner of s@evier server/Application Server. # TF above eb applicakon if vealed fo Toe software then the thied pony PPL relaled jor file must be placed to fhe libranies folder of the project: Source ede ef above diagrarn based application Fopuk. biel Shore ackon “dur!” methods "9et"> Eerployee oO! S1 Foe ety eeceeqgeooooe 7700CO88000005°oO 29099099 ecooooceo ececcoceccuy - DESev + 50u, C49 fnkroct with PB sho using sypey drver onc _ogproach U)) frporr Jjauor Servier *; ferporr Jouax: Servier. DEEP: Ht Tmport Jaua- io: *F fenport jouors sal #7 Public class DBsry exberds uetpServler t Connection Gensou; Preparedstatement ps=oull; public void fork Sey © pereole, jdbo cannecnon object Class- frome Coracle jdbc: deiver Oracle Driver”); cons peivermanager. gerGonection (idee! oracle: thin !@ kealhost : 52h. satya”, “scott”, “Hager”; PS= Com PrepaneStalement ('selecr ename, job, sol frorn rap a where, erpno= 2"); Cakth (excephion e) + priok Stock Trace (97 2 S$ ytothO public wid doGer CHEEPSevierRequest rea, HEP SemmetResponse 9s) throws 3 ud Fy eead form dato, jor cos Anseger. ponse Tor (req getPanamerer (1200); ServishExcepiion, Toe xccaphton ori usiness foaic [sar ponamenr valves fo Se Wwery pe: sek Int (1,90); Jexecule the query Resulbset vs= ps: cxeategqueyd OO; process rhe cesulkSer object Sting name * null, desg= nut, bsa=oult;iF Crs -nexror) name = rs-gerString (1); lesge PS: gerString (2); wsal = 5+ 9eF Shing C3); u Wdispby emp detatla ag web page Goer Prinrwetier ese Content ype Cirext/ biel"); pws res: gerariter(: fw: Printle ("Emp derail: "); Pw-Priotin ( Emp Name: “+nare)! o-protle (Ceory Erp salary: *4 bo); popiotio Cry Grp desz t+ dess); dose Stearn objects Po dosel)? © s+ deseor Jr 45 carch (xe phon ¢) epee Sack race (95 3 SP docet (12 Puloliic doGer (req, res); 3 relopostl-» -) Publtc void destroy) 4 _ iF CPS) zoull) Ps-close catch Cexcepiion e) ‘ jo PriarStods tase) ; wu fF Coleman) Con clo sec); ? Catch (Exception ¢) ® <: print shade Facets xy 3 30 dass void doPost (Http ServierReqesr rer, Http Seruler Response TES) throws Servletéxce pHon, FOEse prion. Web 210] Configure PBScV servlet program OH “/ébuel” a2 rl poltern Request URL jo Jesk applicohon hep ‘Zlocalhost ; 2020/D8eRp/ nput-btn| tCeacoescoeocecceoepoesooooes"ose0000. RIF multiple web applicakons of @ server ane untkBing same third panty PPE (like erace thin driven then fnsteat of keeping the 3° pony 9Pz 0 celaed Gan File (Ike ofdbclJON) fo WEB-TWF) lib folder of every applicakon 5 fr iB R&mmented 10 place only once fo Gonmon librory folder of Server ° sofkaare foshankalion 6 cmmen library folder fo Temear 60 8 \Gommnen\ lib Felder Oo \server\ lib foleler © Genmon lie2ey fader fo _wieblagic (any Version? oy eee er BEA home> \wl seever— \eppServer\ lib folder AWhen wer reSource program of Wee application uses the ‘third pany OPE cass 00 inerface then the Servier Container looks for third pony ° 7 oO OPE dass of interface in the following places ond fn the following order O > Th wee-me\ classes folder Self CF not avorlable then (iN) ° DO ath the Jon files axided to weB-TF\ lib folder CF not available srertin) 3 ®) dn the gan files added to Gommoen libra folder of underlaying’ ° server. Clie Tomeot—heme \Iile folder) if here also not Gmming then ° class not found exception iZ occured) 9 Bevery server folernally Uses one Idk SOfkoare so then servict program : Seg TYPE-! JdbG driver to fekract with databsse Sofnoane ther there. wv Pe i= co c0ed of adding ary Jan fileB fo woe-T0F\\ite foldew ond o dass palh ala a wh is i = 5 ot is the difference beroeen sevietGntext cher ard Senleranf J eeaSect? v 2 @ ServerGohg check Cov): SER Is ene re our Servier prograrn (asp progrom o nueo * ServlerGnfig object means % iS the object of servlet Gofainer 9 supplied fou dass Cmplendertta?) fmplemenking Javan: servlet. Sele OF Gook3 Interface 5 KTHS objec ts Useful fo pass additonal data to Sevier S and to read addikonol details from Servier- 7 K This object 72 Usefil fo read Sever oir pamametr Values fom O webu fle ef the web application. S K Servier Gorainer creaez the serviekanfig object to the fnstankakon e and folkialiZakon process of our servlet dass object- ° K ServleF dookainer deskoys our Servier class objecr In pe destnction @ profess of our Servier objecr. Web server 2a\ (wee application) wor (wer application) 1093 (web application) 28e Q @/|©® @® C9- Servier Gofg object tng fle— mage file = sile- JavaSerpt cade Srv GYM Servleh program Ceooceeceeoceccoooeeocentoofogoea) 9 oO oO oO a oO oO oe 0 eCeceeccec ec Servler @olextr object * TF ig ene per web application. So ft iz called a8 the globo memory of web application + sewler Gnlext obyecr means fr je ihe object of a java class (Container supplier) feplementing Javax-servler. Servier@ntext interface. % Servier Gntasner creales jeig object either during deployment of the web pplication or during secyer stank Up: + Servier Gotainer deStroy® this objed autornakcally when web applicahor i® Ln deployed o- reloaded or stopped or when server is stopped /re — stanied + + using thie object we can read glo) init panamelerS o- Gnte parameters from the web-em! file of fhe Web opplicalten . 4USING «Fhe dojecr we can Enow te details of vnderlaying server like server name, Version and te serviet—api version supported by the server USING Hig object We can ger Conjfext path of jhe current web agplicakon and absoluie path of The ony web resource program fn web application. athe dara kept “& 70 serviet@oleur objet ig visible and accessible foo servier. ISP programs of Web opplicaron fin ene _web server 10 web applications me dephyed In that Sia web application® ane here fo running mode. and four web opplicatons ane fere io stopped mode: Con you Jeu me how many Servler@oleut objects are cerrently available to thar «eb anplicwem? server? @ six There 38 a web applicator with io Servier programe In thar three. Servier Programs axe already requesied by clients and other 3 servlet Programs axe enabled with load -on- stantup: can you tet! me how many servierConfig object? one cwrrently quailable fo thot web opplicatton? @ 34366 1U4NOTE: Servier Container creakZ Servlet Godig obfecr for Servier Progrom only when He dass of Servier Program 1g foStantialed Cobjectk creakion). wor servlet dass object, request object, response object, ServietGnfiy ebjetr, ServierGolexr object can not be crealed by Progromrnem manually the Servier Gontoiner creales all ffese objects bur Programmer con get access fo these objecté in Servier Pregrare #70 ger acess to OF Servier Class object Use “IhIS keyword #T get acess fo request, response objerS use parameter? of Servicet) doe (7 # To ger akess to CervietGonfig obj epprosen ) ¢ public class “TestSv extends HS/as Servlet Config cg fair Public void service ServierGonkg eg) 9 His cg2c3) Mose cg here 5 Public void service C-1-) /dlo xen cass TestSev extends 19/45 Public void inlh C > SecvlerGonfrg Cg getSecyletGonfrg 09: eee ee ee Lpubtic meirod of predeficed gencric Saevler 3 clase public void service C9) domes (27) rererh : SenvlerGoh) <9 = getSenvjetCooh9 0; nd eeoceocceoeecoaseoeoo oo OCNOsoN ee ae 29C2OD90099009cppreach@) Je Sood self class methods ond super class be called im the Subclass with oF object: public, profecket method? can RE $e ger acess fo ServierGniexr object approach (l) : Public class TestSrv exiende Hs/as ‘ Public void torr > & ServietGnf9 gs gerServier@ofr9 (9 + ServlerGniewt sc =Cg- get Servletcontext(; ——E EO OOO ; Vuse se here [Srrerhed belongs eo Sevieraofig ? publee void servicet-.-D /dloxne zg Seevler ONG eg gerServier ORY (); Sevier@olext sc « cg-gerServietGontext ©; Yuse $c here & 3 opProach@) + Public dass TestSev eulenole HS/as 3 Public void fofkor y ServietGonleur 5c= ger Servier @olexr 0); yuse sc here Lo puelte method of predefined Genarve Senvlerclast - public Void Seevice (-1-) [deer (-1-) + Sevleraorerr SCs geSevierGniextt) ; Huse se here 4 a + oF indi rectly or indirectly we need wervier@nfig object to ger acess fo ServierGonterr object NEE! PPrrOGEHO? LE Good ‘aege gerServierGonesr ©) wethod elefinikoo of predefined Grenericservier foreally uses Servier @oFig object jo give Servier Gotta chiect- class 3 o 70 moke 3PBC Gde of servier progrom of Flexible code fo ° radify th 1B retewmarled 12 Sather the following Aur clebaile ° of Joke cole from ouktide dhe Servier Progrom. They ant ia co Ipbe driver dass name 2 WITORe URL c @) pe Username ° DB password 6 0 there ame foo Ways fo Pass foput Values fo Servier Program from o outside the servlet Program: ° 0) request parameters / form dato a ~rend Ser /yisitor of web applicakon sende Frese values through Cc ° browser window Cfreen client Side) —F since end user iB nen- technical person this data will be 9a - technical data, like name, age, address of end User a servlet progean uses request object fo read request paxomekr vobes: Q) Secvler fait panomeers 7 programmer passes iz dale fo servier Program from urban! (server side) —> since programmer i8 fechnfcal person, Hig dara can be technical data like jdbe oriver, UR and ete details —>sevler program uses serviekGofig object to read! fait poramekr values of web! To make tte JOBE code of Servier Program ag flexible Gde to modify ir iB redommonded fo galher the chove Soid DEC derall® (driver cass. URL, Usemrame, POSSWord) From web.xml file ag Servier wit panameee values + Inte pomemerers one spetdic te each servlet pregiiers qav hes! fre jeormmes choke sed °o ° ° o o ° ° ¢ ° ° ce e © © ° ° e ° ° ° e a uv °eccececoce cy efor ceiced pecrp applzoiten thar uses serviet foir panameien to make refer agpkcakon 4) of the page [0% 65-65 jdec q@de of pBsw Servier aa flexible ade do mdify 4% Sed fechnical foput values fo Sevier Frogram from urb-rnl file az talk porameer values: Send non-technical input values fo server Program aA request poramerr values / form dara- piffecenr ways of ceasing Servier 7F Panameter valves SeevlerGonfrg cg = getSenvlerGnfrgt > Spares cb uy String Sl= €9- geh Inf ponameter Cdriver’); here we musk now init parameter name to get jhe value. opproash 6) Enumeration @e cg. geFTni't Posametername SC); chile (&- haBMore Elements (>) 4 String nome, = (String) e- next Element (5 String Vol = cg. gerLovt Panameler Crome) | 3 @gvez oll fot parameter names ond values - RUhen you Configure multiple init posamele® io web-uml file bowing some logical rame then jhe St value Us!) be effeced as thar Init podaretee valve. + Sing ServierGnfig abject we con gather the Gontainer crealed object name of our Servier class S:o°p (“current servier logical names instance name" 4cg-ger Serv lehomer + gives Gerviet-name> tag value from web: er) * TF muniele servier/ asp progoms of wer application ane looking 40 ese Same Inir parameters then instead of placns pom In every Servlet Configuration fr i recommended to unite “Snly once in uxbaml 8 Golext Panamekr& Gr) global mit parameerss and Use serviesGnker a> chjecr fo oll servier/TSP programs fo read these coolext parameser values, > | i. ....... ,.,,,; with pa software by using some TOBE driver to make thecr IDBE 4 Gde of flexible code fosicad of specibying 7PRC driver detocie a oS [oir paramekr2 ih every servier program Gofigurakon ir je recorom. a ended to place 3D8C driver detailZ only once. fH web-mml aB conker Porametré @2 shown below 2n_webxm) of DAP web application delver SPonore- value? erade- jdbc: driver. rade Drivers jpoxam-value> a 6 a a ° a ° a o 7 Bo S/aontete - poxarn> : / 8 dour! oO ¥ jdbc: orade: thin: locas rest +152): ord c es 5 & © 3 ° j 2 ° 5 Figen S/pevr % <1o-pr csevier? PBSev Servier -cla.ss> senile name? db url patteen> burl / uel parte eceoeccoececca200.010 9.9 3 : eee & servler-name> FestSry SS-07 E /esturl ¢/u-p> Js-m> In totk() method of pBSry Sener Program belonging fo Deep webapplication public void toftc) y try t read fotr patam values from web-.«rol Servlet Gonlext sez get ServlebGn text>; String SI= SC-gebinit Panameter C* deiver"); ~~» Gonicxt Panamelte name String S2= sc-gerInit PanameterC “dbur!"); String $8+ Sc getTnit Panameter (* douser*); Sting sy+ Sc. gebInitPomameler (*dbpwo")! 4 Usame a2 Prewious opplication code. init ponameter® one specific 40 thar serlet/asp Program for whitch they ane Goofigured- Gnext pomamelers ome visible tm all web resource programs Ciava based) of Web applicaton pif ferent way8 of reading conjet posameltr values Servier — Se= gerServier @otexk 9: anrecach (1) Siring Sie sc. ger Seevlok Toit PanamererC*deiver): here we musk kau context parameter name to get ire Value Weapproach @) Grumerahon ©= SC: getInitParametr Names; while Ce-hag More ElementZ0) t String nome= (String)e- nexrElemenk O : Sting val = Sc. getInit Panometer (name); i HER ON Comfexr parameter Homes and valvez- we can Use some name! beth fait panamerer af Serviel grogram and for Conteer parameler. we can acess both Hege Patameter values fo our sevier program using servlet Gnsig, ServierGolext objets respectively: TO gather misc fofo about underlaying server vse servlet Gonkxt 099009960999900999290 object af show below: o ZF acthecing mise jofo using Sevlet@nlest obi Po-PrintIn( “server info 1) ¥sc- jet SeverInfo 0); gives Apache Tereak 6o. Peprintlo(“servier opf spec version impl by underlayiog servers” + SC* getMojorVersion (74"-* + Se-genmincavversionv) owes 2-5 — Perpriotle (*conterer pol of current web application :* + se-9¢tGantexsPatht)); ves /o8Ae? perpriotio Capsoluie path of inputhtol on server :"+ sc. serReal Palh ( * Viog uk bh”) Gives Tomear insiesiarion PIR and “rpubniml * Tomcat 6% —> given based on senler api 2-4 spec + Tomcat 6% —> given based On Sevlet api a-s spec + Tomeot 7:% —> given based OD sewler api 30 spec Whar 18 the diffrence bekoeen cade placed i jhe consivuctor andl Ge placed tn the fofk © meitod of our Servier program? nce Servier contac TreMCR —iulctganfig ebyeci AFI exe Consivutor ececoeecoecenree00000000 extcuion ond before g¥eaun init) method exeeuhon in the. fnstanhalion ©o ° Oo oO oO oO oO oO oO oO a ee wae eece and faikalitaken process of servlet program 30 SenilerGnfig object jz pot visible f Gonshuder bur vistole and atessable in the fio method Since servietGokecr ebfecr con not be accessed withovk Senleranfig object so the ServiekGotext vojer jg not accessable jf the Gonstrudor but SenlerGotext object iz accessable fo the foitt) method the code placed in te donstructor of Servier progrars can nok Work with folk ponamelesé and Conkeur Poiamelers ushere as Ihe Cade Placed fo fnik 0) method can oft lBe Hese ponamerrs so Tr is always Fecommanded fo place pe fnitialiZaien logic only fo toiti> method. Tdbe Gon object a j Direct Idbe an obj 2 Pooled Tdbe con obj To geal direct db wo ob) dass -forNome( “oracle. jdb¢- driver-OracleDriver*); Connech’on cons Driver manager. getGnnzcton( url, uname , Pusd )) tthe Tdve donnectton object thar 1B created by progrommer manually 1B called as direct Jdoc Gnneckon object # the Fdec comneckon objet that cotiected From Tolbe Connection poo? 1 called a2 fooled gdbc conneckion object. B dypes af Tdbc Gon pools © Deiter managed gelec con fool @) third pony so monaged Tee Gnnection pool (like Apache DCP. ¢3P0, proxo8! ard etc) Gy server managed TJdbe Gneckon pool C1 web server. application server environment) # Oracle Bin driver gives ome built-in dee Connection peol in HB Qidtc Jan file. thar Grmecion pool ig called a2 Deipermanages Connection tuys2 pool: use~ (1),@) type TdbC Gonnectivn poolB fa stand alone applicatiens Use ( type dooneckon pool fn those applicotons that ane deployable. fo the Server like web apylicakong, EJB Components ond etc 3 in Drivermanaged, third porty sto managed Jobt Connection pool eoviran. 9 ment we need to 088 fypel/ typer) types jdbc driver? G 4 tn server managed Idec Connection Pool environment we need to ose 9 fypeS with typel/ typea} lypey Jd& drivecg. 9 4 Gach Idec Bata source object represenk® one Tdke Gnnection pol 9 to ger each Gnnection object from connedien pool we eed fo depend a uPEO thle dato, Souree object. : 4 JdbC Doraseurce objecr means ir ik the olject of o jaue dass 9 thar fenplement® joven: sel Dato.Soucce interface - . #Oll Idee connection objects ef cenneckion pool represente connectivity O Wik same darohase sofhare: 1dbe Coonecrton pol fer oracle means all Jdec Conneckion objecr3 fo jhar Genech'on pool represents Gonneckivily with orade database 1p rea'shry > weblogic registry regisiey based colled 02 look-up operation sub Packages: one built-fo cegisry s/w websphere ——? cos registry # The Cemecton objeck of end database Programming ceplicorion and registry softwane+ cpa applicakion objec of dadi Uoder standing the sever managed Ciawe agp 69 servier Pra / » ger DatoSource: obi cat fron registry ci calls gerCoonedon cy 29 pakaSource, obj ref geta one jdbe Ge obj From 5de¢ con pool three. 3h porasource obj 1B) eorite jdbc persistant logic based eae on 4 Sobe obj en 8) release Gn ob} wae 4 5dBC Go pool ‘software represents Jolec applicakon represents Gooneckvily bekveen, Similanty fhe tathial Genicom Goneckvity between Jota Idee Geenectton pod! environment APP Server [web Server jdbc con pool for radIn server managed Jdbc Gnneckon pook environment 19723 with tyeey joe drivers will be vkised+ Here typey will be Unuized a8 a a driver to fateracr with datobase sofkoone and to ceale Connechvo . objects tn the Gonetton pool where a2 type 3 will be used af a @ profoc| by client fo ger Ore jdbc Gonneckion object from sdoc. Q @orecton fool a with respect to diagram 0) TL or PL wakes applicatton server to jnferacr with DB sho Usieg Q ype! or lyper or typey rivers and creales jdbc connection pool having © fdbe Grnedtion objects ‘ @.G)7 TL PL creales datasource object representing the above Jdec Genneckon pool and also keeps har dato Source. ckfecktio regishy eo sofkoane having niclename for globod visibility. . (4) —> clienk opplicakoo gets parasource objecr reference from registry c software through look-up aperakon G 6), (6).G) —> Clienr opplicakion calls getGnneckion Ly en dparaSaxce object $ reference this coll uses type protetes io get one JIdic Gnneckon a bject fom Gnnection pool: . ®) + reer diagrom ° 8) > refer diagram 2 NOTE: the released Connection abject fo Jdbe comeckon pol becomes 9 peody wo gle Service fo nexr ewes or next cient. 4H pee eee eo Gees | fe 9 fo GlassFish 2-« Server 3 o Shep9) plage aideery: Jor File fay cgup_bamel Y AEpser¥or} denn 73 Nemain\@ EX eats folder : VERGO: place mysel retail Ganector 5 jdbe driver’ jan File. Corysal = cen Ader - 59YR- 3-018 ~ Stable -btn- jon file) io Glast Fh he: 4 \ clones \domacn!\ hh Vext folder ecseooca 4 © sfep@! sramr GlassFish server ane open THE admin Console (domain) Server’ OD sep@: create Jobe cnnecvon pool for my Al Y 2 a Adiin console —7 resources —7 Jobe —> @oneclion pools —r eead—r oO 9 owe : frp pes | o in Resource type: \Javax. Sql. Boro Source VY) Darabase vendor : [ep al] : [esa] } —tnewt —> iniKol ond minimum pool size: [BE] Goitral cope o a mow pool side! [a] c 9 oe o idle Hime out : ° oO @ Database came - [sbi c TA password = [root] oO Port; [3306 © 0° Pork purmber : 5 Wl servernome « [esslroae} . TA VAL 1% Selo: ry sai 8/ locothast ; 3306 Jab! oO url t jdtectmysal | /loco) host: 3306/d41 ° (Quse ! reor 9 —H? Finish —p Lownch mypooh Ccltck 09 mypeol!) —7 Prog cHpQn: creale Jobe Dalasource representing the above jdec cnncekon oe D pool 2 uv Admin Console —> resources —7 JUbe —¥ Idec resources —y aa —> a 5 INDI name: (ary nome) Cit beGomes Nickname |r alias name z orce pabaseurce ehfect 15 registered Wir o Pool name : |mypeol } _ v V9 aK v 19Dwie wil! once 0 wHOD iB clicked the above creaktd DotaSource object be registered With registy software of GlassFish Server aulomak- cally with Np) came DsIodi Eoxexarpie web application where servlet program uses the conneuion object of jdbc GonecHon peal fo inferact With DB Sho Browser window bynamic webpage FAA (D8 tele os him) fable) eo| fodex + hin Glass Fish Sener (8 Gon SF From JC cn goo) ) E: \ pepe [+> real pp | + wes-ior I fodex: bin eee ee 2b reer} [eee > cennpoolsecvlet + class * Poepaming war file. ai # deploy \Peps\pool app Sfoa cf Pool App - wan the above wan File in GlassAsh 2. server SBUQSSEISh— hame>\ app server) domain? | domain t 92 CoCSCTOOCOSCE OL DCO CRQDD EOS OOSC OOO OOS OOESGe200099055° oO o oO 2 oO oO v Request URL to fesk the applicahton (heee:/ localhost: 515//poclapp/ foclex « hin * For ebove diagram based example applicatcon refer applicahton 5 of the page nog 65-63- * Bloay? devebp web epplicahoos by teeEPing nos ~tennicl mip end set fo mied for tat awben caceptien ip raised in web reSource Programs instead of disploxing the exception celated teormied! messages braser window fr 18 re@mmanded 1 display those messages as non fechnical guiding message? for enduser. For this we reed 0 core Some Presertalten loyic fn the catch blocks of Sevler Programs #Indi api ig parr ef jova se module so we need not fo add ary jon Filet to classpath while work wit Jodi opi Procedure fo “reakt 70RC Connection pool for oracle Dako Source fn oracleweblegic 103 SHPO); srant Adv javasatchPemain Server of weblogic and open th8 admin console Stank - programs —r oracle weblogic —> USer- Project? —> Ady. javaBatch Domain — stort Admin server for weblogic server domain wep? oper browser winded the following oRL heeP! localhost; 409! /@msola Services —F JDBC —> pakascurces mew —> Name: myds! Clogicad name) INDE Nome ; DSTodt — (Required for client while perforning lakuP operakon) parabase types orade patabose driver: “orocle’s Driver Cihin) for service connections” —? next eet Database name: satya Host name: becalhostpork no% 1521 Database username : scott Dorabase password: ger Conform password + Hger rest Gnfiguration —y next —7 selec admin server —p Fralsh NOTE! when finish bulton jz licked the loka source object iAat represenbs pee Gennedtion pool for oracle will be registred with regishy sofmore wilh Sed? name “pind” SEP)? speafy the TPBC Ganection Pool additonel properlies Admin console —% services —7 JDBC —+ Data sources —zmyd5) —» Conneciion pool tab —F Inika) copacily (J maaimum copoccty [5] capacity trccement rspecifres the ro: of oa JOBE GinnecKor objects Hat should be created at a Kme ff there ne ee ee eters fo 4h Genection peo! > save —y Advanced —F shrink frequency + [joo] Seconds —r[EaVE) ‘efor ORWZing the above server monoged Connection pool we can run the appiicahen @® oF the sookler. for thar SPO? make SUE that the Adv: javaBatehDomain server ig fo eunning mode SPH? make sure that DSInd? is specfied ag the argument value of fe-lookupé-) method fn fice 90 SIZ SHPO Propane dhe deployment dlicectory sirvture or wan file representing dhe wets application pool APP ee INF > dasses oclewthienl Gorn PodlSenvieh Java, wxbamt [; [-—> Gon poolsevier class SEPTY)< Depoy the ebove Poolorp application to Adv: javaBakchDemain Server of webjegic caps the Pocloop folder to weblogic-homne\ widvlewane\ User. Projects \Domans\, Blu: JavaBokch Dornasn \ Auto Deploy folder. I9OODB9N5 eescscsoant coos ecooooeocae ef ececcoeocececstepw)i Test the application peips // localhost :700' /Peolenp Jindex+ btm! boss server boss server “yee i application Server softowe version: 5°% Campotable with Jdk 1-6) vendor t Apache /Red Hak opensource Sofkoane pefaulr port aac S080 news to creak domaing and also ges 5 builtin domaing: they an a) default @) web (© standond oat (Sy mintenal te download softoare: daunkad slo as zip file from wow.opache-org website .srallation process 4 Emtradk Toss -5-1-0-'GA- JKE. BP File to Oo Folder. + gon file thar represente all Jee APE? jkOSS~ javace- jon (Jkoss-roreg\ rent) Procedure 10 change the port mo: of Yefaulr’ domain server of boss 5% Geo to TbOSS Home server \default \ deploy \ jp0S5 web jan\ server aml File” and modify He post atbibule of fiest bag TO srostt jboss server (“default clomain) use jbossneme \oto \run+bakeh File #1q Tbhoss server there, 12 90 console deployment. Buk hard cteplaymert 42 onoilable (only won file based hand oleployment is supporied): Notes Tooss, GlassFish Server directory based ford deployment . They only support -war file based hard deployment. reProcedure to deploy Jawa, webapplicotiod tn default’ demain of boss server skpOt creak .won file on the deployment directory Studer of web application: £1 \peps ee wooo = WEB-TNFE ~~ i: detodla-bko! 7 ~ to prepare wm File €:\ opps \HeSlAre > jor cf Hemline wan SHPO) stant default” eormain Server of TboOss SEPGI Deploy the we application fm ghoss secver copy the above ~Litminep.wan* file fo 3b0ss-home\serveridefauit\ deploy Folder. skpUD: Test the web application open the browser window and Wype ofthis orl trp: flocalhoSt : S151 / html app/ deraila- him! Gmnmen library folders the common Iibaary folder of default’ domain of Tboss i8: Tboss-home\ Server defowlk\ Lib folder Procedure 40 Grfigure boss With mysdipse TOE taterclow menu —¥ pre ference 3 > my Eclipse ——y servers —7 hess 9°% ——> Enable Tbess_home diceuory: gerver nome (domain name) — apply —pors oencececoos ececrceceece:Ox) oO oO oO oO o servlets on from oa browser window and Processing fab repost & chain jg called af servlet chatoing In servlet chaining we perform communicaken between servikt profrans to process the request given by a dltenk lek chaining Taking requesh by sing roultiple a * All servier programs request and response 7B given by dlienr 10 perfor Servlet chaining Dispatcher objecr means dass implementing Fre oe aypication Servier chaining based Webopplicafion thar panticxpale fo a object because tr iB te objet of o Sevier chacoing will Use seme ‘hey process fhe same reqesr thar we need ReqestDisparcher object Rewest— @nrainer supplied Javar favex: Servier. Request Dispatcher inker face Servier chaining a —Lr—r—S—esSs |p Forwarding Request mode of servler chaining The biel ep ef sry ail ke dli-seonded ane! the oni bil oyp of sev pro sees to brveoser tide as responce” Sew) (source. Servier) 2-twcluding Response mode of Servier chaiaing- se. seeviet) SCV! bro! ofp ‘wit! rot be discon He bel dp of beth srvl, Srvb loge FOES fo brouser Windows as r# Spence, pesIn any mode of server Chatning ys programs will use same reqest and response’ objeuz- TF seus, servi, srv3, Srvy Servlet ProgramZ axe there in forwarding request mode of > server chaining then the Heal Op of Sev, sey2, Sva Programs will Le discarded ond only fhe ofp of sruy Servier program goes to browser window : AIF srvt, Sev2.8V3, Sey Servier programs axe there fo focluding responce mode of Servier chaning then tte bho! ofp of all servlet programe fo. * gether gee fo browser window as responce * The Source servier Program use.£ ReqwesrDisparcher Object jo perform Servier choining wilh destnanon ub resource program (like Servier Program, {; JSP pregrom hho! program and e&C---) oO o There one 3 approaches to “real ReqwestDispatcher object ty source 6) Servier program poinlieg to destination webre Source program : Keproachd) (ey using rey obj) BE an sevi source cove a rentonal 2 Re qwestoisparcher ed = ceq- GerRequesrD1 sparcher (Jszur I"); G ed forwand (rey, res); Lan patter of destinakion a Sever program (seve) & o d+ include (rev, res); C c £xQ). an source Sevi Program o RequestDisparcher cd = req- gerRequest Dispatcher ("/abc: bhn!") | : @ i RequestDisparcher cds eq: schRequest Dispatcher (- /abe asp)! : cds forward (rev,res); c 6°) o fds include Crea, @S)> 6 o Aprreaach @) (ky using servieronlext obj) 8 EX)" In Sovree servi program & Steyler Conkeet Se = gerservierGotexr emerson bo ReqpesDisparcher ed = Sc: getRequesrpicparcher (* F2urt"); - d+ forward (6%, eS) Tome paren of dest sw [ ec Presnam Csr)ds foctuder reyrres); XA): Tn source SrvI Progran ServietContext Sc = gerSerylerG@olexkt >; [Prmardates Request Disparcher rds Sc- get Request Dispatcher (Jabe -birnl); on Reqvestpispakcher rd = sc. getRequest Dispotcher (*/abc- jsp); te for wand (req res): — eds inciyde reqs res); Approach ©) (by using servierGoniext obj ) 6x0), 29 sre sry) Progr Servier@nlexr se = gerServierGniext ©)7 RequestDisparcher rd = sc- getNamed Dispatcher (” sa"); | Ty logical name of dlestinati~ ed: Krword (regres); Servlet @rogeary (like 2ru2) or) Biven in were! Kile ed includes Creve); EL@)i an sre sit Progra Reqwest Dispatcher ed: se. gerNarnedDispatcher C52"); “+logica) mame af destination rds forwoand (a, res); TSP Program like abe J5p 6 ed clude Creq, res); MoTE (0) af seurce Servier program calls rd forward Creq.ces) method then COCHHCHOHOCAOSOCSOSOOCNOIOOIIO HOS SFIIIIIIVI DOD ik performs forwarding request mode af secvler chaining with destination toets resource program. NoTG @\i In sSowce servier Program calla rd-incudetrey, res) method ten iF performs including response mode of servier Chaining with destination web resource Program eservier Genfiguration fy web) ig mondalory so tt name and URE pattern. TSP Program Gonfigumeton fn usb! file is opKonal se it may o Contains legical ecoceecccece may cot orkein legical mame and URL patlern. We can aot Configure hel |7 . te. program to webraml file thar ie the difference between gerRequestDispatther ( ) and ger. Be Named Drsporcher(-) methods > a ee getReqwest dispatcher «) 41 Nomed Dispatcher (7 tovokable en both rEquesh, servletonkext 4) anvekaile only on Senvlercanient- objects. object desrinakon Ql Expects URL patton of <'Servier progrom — &)Expech# fegical name of the or file names ef destoakon xSP or Gesknakon servlet /asp program pho program a angument value o2 angument valve ©) THA mubed generated ReqestDispakther —@) th'S methed generaled ReqestDis- object cor point gly the desinakon Pobcher opject- con Point only the Servleh, 38° Program and hho! program destioalton servlet, asp programs whar i5 the difference between the _Recuie st Dispatcher ohfect thar is creakd based on ReqestObfer and servletGntextr object > fee One entnaecmmrt (@) the Rewest cbject based RequesrD(sparcher object expects that source, Sevier program and destination web resource Program fn a same wes applicaxon A the ServietGniext object based ReqeshDisparcher cbjecr allows to keep the source. servler program arg destination web resource program cline me some wee application a {9 90 different web applications af same server but they con not be there to hes different web applicalions ef two dif Recor serverz- ecowser, Here Srvf can use req obj or Servfeenieer obj based KeywsrDrepicher obs a 200090905 eroccooeoescesceoceeeceoconeconenD000999999900909 browser Here srt should use ServielGnlex- obj based RewestDispatcner oby web serverd, 1 fai nok possible with Request Dispakcher obj rwo servile Programs of hoo dif ferent une logic server bP-n2otiree s6p2) oa ) i 16 gless fran [00 other wise Ihe. , browser els Server 9 pTest@oe! 9 9 avi ° — 3 Se ° oO Thiz kind of servlet chaining is ° re 1170, US Send redirettion Gocepr a BF senvter chaining i£ all about performing Servier- Servier Gorm unicatton: ° 0 Performing Servier chatoing bekwean a E 0 web ofplicakiong which reside fo jhe Some server ° ° ° ° Copur- html) . Avalye: [3E—J 2 Ld v 0 9 Gy etp vaspense| v oO U NOTE: dn the otove diagram sev progam fonsords ihe request to sea. 2 oPlty when the generated sqpare value 2 sevt direetly senda resporse fo browser window displaying Sen e Vahue- °peployment direckry Shudure tapone, ER -INE ses | fopot wee-mer | —__-__—~rclasses | ——+sev2“joua, ica —— Srv2- dass Deploy both hese wevopplicakens fo web logic server (Adv- jovaBatchbonain) Copy coftone, wanton web application? fo \user-Project A) domaing\ Ady: javatarrDomain \avtodeploy folder On Sev ServieF Program of fhe above WHOne webopplicaken We Mus create Request Dispaicher peje based on rulerGniexr object spurte Code (sone) inpor nol Lior pattern of Seur Sevier program A value! < bey <(fouoy tnpork jouan’ Sealer, Iepoct jouan: Servier HELP; feport javon fo. #3 puvlic class Sev! extends HetpServier patie veld Service CHbepservletRequest, HLipServletRespanse rts) Throws servlet Exception, Lot=100) —velesplay square value on browser wirdao Peo-printle (*srvl: square yal 1% :"+res): 4 else 4 7 forword the request fo SrV2 frograr® of wero webapplication Wer Access 10 seniler Cooler obj of wPone web application SevierGotexk sciz gerServierGotext ©; Ugur Acess 10 servlet Gonkext obj of WOTwo webapplicakion SenlerGnlext sca. = SCi- gekGoleak CwaTiad ) (create Request Dispatcher obj poloking to Sry2 program of WRTWO «eb applicalion ReqpestDisparcher c= Ser -getRequest Disparcher (Y/S2ur!"); I forward the red fo Srv2 Program from Srv program rd forward (req, re5); Wase SY service 4itdass web aro! Configure SCV) Program with )siurl ag VAL pattem Source code (ATWO) Servi java, Tanpock Jawar: servlet 3; impor — jowax. server http-+; import Jawa. 10+ # Puwlic class stv extends Het pServier & Public void Service CHbtpSevietRemest rey, HetpserierResponse re) throws servlebexce phon, TOExcepHon: general setkogs Prictusriter pws PeS: gerwritera; tehres. SetGonjent Type C*feuk/htnl")) (reads form dake. fot 90> Tnteger- parseInt Crea, - gerPomiam eter (tH J) Ifiod wt cube value fok s1¢32. 2 90% 90 #99; idisploy cube valve Pw-Printls (Sua: Cube vale 58 :“eres2);, 2009903009 Bur seevice (+=) aéclass web: %rn) Configure srv2 program wilh He URL poHen {seer URL to Hest He applicaron heEP: //localhost: 4070 /upone / foput- hiro] the getGonteer C) methad of Sous ¥O when Hak rnathod Sawa. long-ullPeinperé Keepin leks In most of the servers _ genie Grier interact 6 oot teoplemensed ie calle io Hose Servers we, will ger ee) fo this cevler chasing serve 400 didferent sevvier Prog. pee ya or possible. in 1o9St of ha different wee apelications (ike Wabl@ie lS, Temoak of versions, of ihe Servers: gRoSs Versions, Glass Ash all var$90) x E lgic $x and por te ob0ve S0td chaining con be acheeed fo werlvic & oe Servers F Sine gerGnient ©) method of Sevier Goniext interface i& not implorsnied Propecly in all secverB so we can say the Request Dispatcher object wased Servlet chaning 12 good only when bolt sounce Servlet Program and destination Web -esouce Program resides in same wet application. “ia remain Yo sivalions iB recommanded Jo use send cedicedton concept 7 johor is the differerke between rd. toclude 6), edt. forward method? > Refer cespectve diagrams and key points of previous concept KT Enon the went javo version »java —yersion Fiche multiple Sak softwmes ane installed fo your @mpuer having different tonS then that Idk vs SCoooecooose ocoeeeoeocococooODOD000 vig im placed as First value ef pai enviconment vancesocc ecoco$o ecceccccecoce tote applicator _[s2ud_is the unl pone of sna py srvi(sre peg) nate comes — © hetp response. Here Sevi program Cer rg) him! o/p will eo be dliscanded. moreiver eo Seva servier program hte! outpubs tpgelher goes 10 browser window a5 response # cd-tnctude ¢-/-) method performs including response rode of Servier chaining + Boin seur and sev programe will USE same request and response: object so the request data, coming fo Sevi if visible and access— able wm srv2- TO Fass additional data bekween sev} and Srv2 Use request attributes 4 Browser Window gers response fom srul program by having the him! olp of beth Srvl and srv2 programs x srur hel fe can be. foclucted ony where in jhe. Iphol op faa by calling rd-loclude @-) method in the aquired piace. KS ord sev2 con be there in Jee Some web application &) con be there fn two different web applicakons of some server. # Sey can be a senller program, TSP Pregrom er) htm) — program AIn real Hee cde include G7 1 oseful fo include the ofp of reusable legice like header and feokr logic’ in jhe oulpur of Chm output) mein web resource programs (Sieheader logit heoder legit main -contenk logic, main -cortenh logic. fooler (0! (Generates web page!) Generases web pager) Coenerakes uaels page 3) Ol web poge® of Website generally Contain® Same header God footer conents Wr the main content wilh be changed tn every Web page pin the above diagram heoder ard footer logics ane not reusable because they ae Placed In al! fhe three Servier Programs eventhough Whey ane same for al dhe tree Sevier Progreuna Solukoo + oo - ta Solution diagram soder and — footer logicz axe seperakd fron main servler proseamg of web appiicaticn and they ame placed fn to Seperole web ressuree Programa but their hol oulpr be fncluced fa main Servier any retreat) pregrams bln) oulpuh. thig tndicates header and feckr logics axe made eS reusable logics Cceeocoeooos 3G Oeeeooo000779000090905900999990599229099090 ° eceoaoooo°o Ceocceccoc ca ¢ sample axle based on solution dlagram Headersry + jove (having jpeader logic) public dass HeoderSry extends HS public void Servicel-r-) throws senVlerexception, TOBKception ' Prinheriter - po sre s. gertoriter (97 " reS: SekCeokent Type. (Hexk/ him"); Par peintin("s a TH yA <) foot? J : Pe“printle(” "); Don place punctoset? in 3 jreaderl 12 the Headersry Servlet Program Header sry footer him! having footer logic) gi? Mace Servier pege Public dass PeeSrv 1/2/3... ln extends HS + Public yoid sevice C_,-) throws se, 705 ; Reqest Dispatcher rei ull, eda = pulls rey Minckide reader Content from Headersev ral = req: getRequestDispatcher C/headeruct”); rdi. include Ceey, res); qos 10 generake main Gnker of web page Hinde feos Content frore Footer Aho) edi = rey gerRequest Dispatcher (“/ footerurl"); dr + include req res) ; a catch Cexcephion e) 1 €: prinkStackTracet 7; a (5gFone the cd> forward ¢-,-) methoo executed fn Source Servier program 4 Ihe the effec of rds include (-1-) wetbot call ott ook be there fio thar Sevier Pregrom that means «d+ forwond (-/-) method call discaxda bolt direded ond included hn! outputs cf Source servlet Prograsn- 4 Fer example application 09 bol ciforwand(-19+ rd-inelude (-.-) method call2 refer app ©) of the page Ap 67-70 #nephs For example applicanion en el-forwdand¢) and rdrincude ¢) alse refer app (8) of material % while working With rd-fnctude (~/-) method don't Gornmir the response fo deSHaaren Web Source progr by cating Pus closet) rnefhed because th woe allow US fo add forther oulpur generated by source Servlet Pogron ond other destinakion Programs. Sub we can do His Work Sooceoesescsnnr29099599090¢2 while workeng wilh d+ forward C--) method ¥ Don't commir fhe @SPonse in source serler Program by cating purctoser method before rol: forwand C-1-) method call because this process thrans g Jova-long: Dllegalstaleexceplion Coan forwond ofier cesponse has oo eo bn Puorclose ©) commit the response of web resource program —jhabk means ft does rot allow) to odd farther content 40 response (GOD understanding ad: forward ( method http response. “The html outpur of sevp 9 1 ___________——— 22 ditscansted ant any the hel coper of gr al 9k eceoneeceererc*ceceoee sponte82 8) 688 2 ee ae 8 |e key_pofots i ree forword (-/-) method there to perform forwanding request mode of Servier Chaining- & Bo, SI ond erv2 Servier programB will Use ame request and response. ebjers #0 the request darko Coming fo Seyi Clik reqwest panamerers , heades one vistole and accessable in Srv2 program #1 pass additonal data beween servi and srv2 programs use “request” abtribviee- # All the Stakements placed fo Srv program before ard after rol-forwaw roethod will be execitt bub the entire brn! outpuh of Srv) program will be discarded + # BOM SrvI and Sry2 can be there ether fo the same webapp lication © hoo different webspplicaHions af Same seryer #ErV2 can be oO servler program ed Tsp Progra Om) bi! program # d+ forwond Gr) is very usefel 19 Confrguee Grror Servlet for offer ain servlet programs of fhe web applicakion what ix Error seryler? (@ The servlet program that execultes only When enception2 are raised io cther sevier program ip called a8 Error Servier This servlet i@ useful 40. display exception related messages ag non- techmical guiding message on browser window when excepkon8 ane raised fo other sevkt programe of web appkcation sample Gde to cenfigore Error Serviek errsry: javey Public cass ErrSv exenda S/S x public Void Service C-i-) Hrrows 86, Toe - cas: SebGatent Tyre. CHeet/ him")! Pricktoriter pas = res ger coriter 0); Pron peintin€ “< font Color = reot plalernal Problem ); (4)poo: println ( Go te Sa bref ="inpot-himl> tome "); Jur service(-/-) jrdass U “feur\” i8 the orl pattern of ErrSev program (in web-l) (mato seniler program of web application) public dass peSev extendg lS public yord fofkC> q - - Same a8 previous applicaton - 7 7 (oe cate) 3 public void doget (-.-) throw SE, ToG 3 ty 4 = some as preyviou2 opplicakon 7 Grose wee) 3 catch Cexception 9 4 try 3 Request Dispatcher rd = req: ger RequestDispatcher C“/eurl") : rds forward Crea res); i carch (Excephon €1) J el Prick StockTrace()! 3 | EEK EEOCOCOOTCTOCOKDOOHDEOONDOSOOSOHOOIDIDOEI99IIIIO DSa fuotic void doPost (---) throws sb, TOG doGer (req.res)} oO t public void destroyty QO #2n the above sample code when excepion raised In the ri doger(-1-) method of pasry Sevier Program the Error servier C&rsru) . program will be executed automatically because of fhe rd: forward C-/-) 0 —— rpethed call’ e KTP Servier pregram contains rd: forward (-/-) method call then tha 2 Servier program him! output will we discarded but their sopl'-") |. i. ges 8 Are ee ee) * Prograro with Ganditon stakement show thar Mme html — ovipur OOF tar source serviet program waft! be discarded only chan Other condition is satisfied otherwise the him! oulpot call) nok cand eck + + Dn real Hme prajects d+ forwand (---) useful fo we Gonfigured Grror servlet and to make wee applicahon® 98 more end user OU frrendly web applications. ° © pepleymenk gi oO ey rectory Shruckre of the above sample code based u ebs application a)dasses |? DB sev java. | poftbbe 14 307 [> vesey class coe’ 28) J—> errsry + java, [> ersrv- dass * Develop the above web aplication resources based on above sample Code and opplicahtoo @ of the boolclek- ine lircitakion with Request Dispatcher objet based Servlet chatoing fe tt can rok be Used When Source servler Program and destnakeo web resource program axe placed % hwo different wes applications of same. server Cvery feu) servers axe Supporking this)ier) tn boo difftrent wee applicakiong % two different Server$. to overcome thie problem use Send redirection concept of — response: Senel Redlireek <3 method ae ae Diagram u) Redieck (*/swel): srva,(dest Pra) Frnal esporse The hiesl output of Srv! (sre) Servier progrom will giscanded ond only the brent output of Sruz (lest) servlet program wil be displayed on browser window as response. J8 tke URL gruken of Seva sovler program: ° COCCHHHEOOXOSOFOOBGONCOSS3I00999090 ecoocrnecooceDiograme) webserver or pplication server Browser _wiodow el beep: 195 rl (aeqwest Url of Seva program) ve LEP: local host:2020 /wwee | seuel st ud of ror) ciagram®) Seoesser csindow 'o01/oAa} stort); IvyUsing Send redirection Concept we can not perforin response fodusion bor we can forward request from one wee servier Program to destication web resource. program: + WiK, respecr fo dhe diagrams () Browser window gives foitial request fo Srvi Servier Frograre mal she stolemenis of Servi servlet program exeauie® Indudog res: senc! Redirect (-) rmethod (@) Servi program generates implicit response $0 browser Wiedow howling Hee vet placed 00 send Redicece (-) method az argument valve: The response StaluZ Gde of this implict response 13 300-399 Cindicates re direckon) + ) Browser window Uses the URL @ming from fmplicct response Checause of 300-397 Staluf Goede) and generales fmpliwt request to sr program CAD fee stotementa of Srvr program exeaited ©) The ovlpur of Srv progron will be discanded and only fhe html output of Srvi Program goeS to browser window ag final response- Key points KR SrVI ond sria will OF VBE Some request and response obfecrs qty use different ses of req res objec. 99 the requeSi olata Gorning 10 Sev! POGram 18 oF visible and accesszle fo sev2 Program #0 send additonal dara from sry) Program = sry2 program oppend qwory SHIPG to the, URL of 25. send Redlieeh(-) method fo seul Progrom and read 'hose yolueB fn sev program a2 rewest Paramerer vasoes de sev og res: sendRedivect €"/s2ur!? pls val! @ pz = vain); feS- sendRedireck (” hkép:/loCalhoSt 12020 /onz /s2url > pre val! Epr=val2"); 6 1eS Send Pediceck Cnttp: machine 2: 300} Jar] 8011? Pie vals 4.Pr= yaa"); Ste Shing Svs 84" SerPonamerr ("91"); fog sim rey geeencurcierC' PH) 20 292390009090 ecoroceceor seo eeeoegeo0005CCCO0000* Sri ond Srv2 en be there fo the same weP application or con be Ahere fo two diffrent web applications of Same server or hwo dliffereot sever® (Hese two Servers can be there fo the some Machine oF fo two different machines) *# TF Srvi and srya resides in the game web applicakon woe con pass relative peth tm sendkedirect (-) melted offer wise we rust Pass obsoduje val ¥Srv2 can be @ Sevier prograrn or JSP program or him) Program or ASP progrars er OSP-aek Progrorm or php Program ebc.- ‘The ovement res.sendRedireck(-) method execules 7 SrvI program ite entice hil outpur of Srvi program will be dfscanded. In real time to pass tre request of one webSile 10 another website ssithout worrying about their féchology environment we can vse Send Redicection IBM has acwired rahenal-Gom go the request given fo rakonal-com wit be edivecled fo certain web resource program of fom-Com wee-ane A cla.sse2 input entra 25 pu Pe Srvi-jaya, sryi- class Deploy in Tomeot server rest npr. WES-ZNF dosses vo Sawo J xb am [fs Deploy to akvsJavasotthDomain of weblogic sever [beTestApp! Cweb application) foput: btrol A value : B value ¢ forra + html, ‘Sum iB: 50 multiply “600 weblogic server TesrpeP2 Cwebsapplicahvon 2) Servis Jaue: feporr Jovan: serviet- #7 Import jawax- serviet help: *; Fepore java fo. *; public class Srv! extends Httpserviet Public void sevice (-1-) throws SE, Toe a (general sertegs Peinktaetier PwW= Cesr gertoritere! £23" Seb Content Type (HF /hieg [*)7 Werad form date fot yall = Gateger: parse Tob (req* gerPanameler (Ly) SDUP) ? cwers SHI03>); 20999902 ecneocoeoceecoscoen@eeeeonrescoseengoonDoO oO oO oO eooc for yala = Boleger- ponse Tot Crea- gerPovameler( *#2")); W4i0d SuR0 yalue for Som = val) +volz; Pw prratle C* SeVI + sum 2 " +S); Ieedicect the request to SrV2. Pregram of Testapp2 S:o'PCSrVI: before res: sendRedirect (-)"); 185: SendRed ireck Chit sil localhos? : 300! /Testopp2 /saurl > s-o:p (Srv2: after res-sendRe direct (-)"): pucatatioaieena qwory Siving hawing dake. to Wdlose steam obj Sted daka. fo sv» Progrom pus closec?: Sy servicec-- dass ~ web en) Configure Sevi Servier program with “/siurl’ orl-patiecn Tesrppp2 scurce Gade (web applicakona of different sever) Sevy2+ Jovor Gempork fowar- Serviek tenport JaWOx: Servlet. http. +; fenport Java fo. ¥; Public dass srvz2 ewtdS itepservier % Public void service l---) throws $B» 106 Ngererol Services Prinkusriter pws res-gerwesser cs; FOS: SetGontent Type C“iexet/ hm"); Meead reyest param yales Serd Swi frogcam for valt Bole ger poase Tot (reg. getPanameler C*'")), for vola = Inieger ponse Sar (req: get Panam cher (pep); fot Sern = ovegees panse Int Crea: gebPanameter (P)); {G09 e+ revliply valve fot mole vali + valz; Odisploy resuirs Por prion CSev2t sum 79:44Sum); Por Priokln C'seva : rauttiply 182" ¢mul); S'O-P( “Form S$1V2. Program”); Pros dose); {L3web-u0) configure Sra program with “/siurl’ orl-patiero Request UAL to fest the application http: /lecalhosr : 2020/ restoep! | form: him} whor 18 jhe diffrence bewesn rd. focwand ©) and ces.sendeedicect() 2 cd: forward C»-) res- Send Redirect ¢- ¥ perform forward wade of sevier — # Performa Sendaedirectton mode of Gxremuni— chaining cation, ‘The Source Servier Program Communi +The source Servlet program commuaicore® coke® with destieaton Usebresource With destination sevlet Program by paving Program directly. fekwork rOurd fiP with browser window ke The Source Servier program and The source Servier program and destination deShoation Web resource Program uses web resource program will pot use same Same request and response objeas TeWeSt and response object 20 the rewest So request dato coming to source dara. coming to source senile Program is oe Oe ee eee CO visible and accessable in dethaokion accessable i destination webresource: Program: Program # Source servlet program can use ‘append Qwery string request aHribulea@ to send additonal 10 he ort oF response: Send Redlirer() method to Send data jo destination program additional alata from source servier frogram fo desttinalon program: K source Servlet ond destnakon # The sowce Sevier program ond destoation FrogrounB can be there in Same. foc Cle. web application lary server) ee) . hwo dif rent web applicaKor® of Sane can be there In two different server @r) diffusnt servers: wesapplications of seme server Gonly toy few servers) + BeSKAeLIET peagren can be a * DeSHnaHEN prasm can be a seriet 6) a6p eevie © 35p Go ht! Program BDH! God OSPF Pip-mer or) PHP Programs ce, uring forwarding request operation Jel fey the browser address ban will vot Ge changed- During Send Redirection eperation the url th the browser address box will Le changed» {Suitable when source Servlet Program — # suffemle when ec REVEE proymnn ret SU Pe stingien serviek Programm recides — Jesaken Program resides fn tee 400 wre p= naw +Seven tuoonders For_btog Feqpest panameier name bREP!7 twwra-bing -Com | Search 7 9s new + seven+ wonders tweb resource program name For exam source code of above diagram refer applicator @) of the page numbers 43-95 How mary ways one there (0 poss data Lelween the source senler Pragram and destinaton web resource rogram > a 1f source Servier programm and de Stnakon web resource progrard resides Same usb application then uze Merequest atteioutes 2 Session oHvibules B)servier@otenr attribules Tf Source sever Proram and desknahion welo resource program resides In nwo different webapplicakons of Same/ different Cener(S) (eppend query String fo URL Of 725+ Send Redirect (-) method ces. sendRedireck (url 2 "); SOCCEKTOOOIOODCODOD9D00 SOO VOONDSO9O00R bx ces: send Redireck (“http Hocodhost: FoOl/ TestMpp2 /S2.Ur! 2 py FAHbURS albwS US 40 steve only obeCIS- AF we give sieple val = ive Sheple values DP arhitutes then thes ill be Grverted into corapperclass objects and s10 @pi-20"); ° + : © *Ptieibule 18 2 special legical name thar can hold 5. Be ° awa. objecr a2 an value . ° + OFtritoules Provide more vistoi lity and acessabiliy to the dare of 4 3 application crnpare fo the voniablee dedoned in secviet program e ° 2 ° e wil be stored a3 attwtue voles:Se Reavest abiibuies ethepe oneibuiee allocates memary i> reqvest objecr ond they one Visible through out request cucle Browser winds hehe request fv sea 9 oy sey Py, Request oMribules hak ane created "ame servier program of Sevier chaining ane visible fo other servier programs of same servlet chaining because all jre Servier programs of ao servler chaining will uge Same repess ond response objects 4&In the obove diagram the request ativibue created fo Sevi Program ie visitle and accessable fo sev2, Srv3° program but not visible fo srvy program: because SrVI, srV2,/Sr¥3 programa ane USING Same request and response Obie ky ponticgaing th servler chaining and snvy programy 13 pot PANKCIParng fo thar Servier chaining wo creak rewest orhitute req: setAbribute (*pame”, “rojat): GPitavie name Cyatiritue valve req. setAllribule Cage’, new anitger (so); req: SerAkfribuIe (“total”, G00); catribule valve wil bE Corwerted Mato Crapper class objet “ntcoer trough awtoboxing’ To rood request akteitules volves req: setdthibule (name, ‘rajai")s, Freq: SerALIIOMIE Cage”, new Snlege C15))! req: seAtribuic Cota”, $50): tLNOTE: The melted sehOltibule(-,-> can creale naw request ativitule or con modify existing request attribute volue. to read valves fron request attributes Stoing Siz (String) Beq- get ALfribule (name): anteger $2 = Cinkegeryreq- gerdttribure Cage”): rea geththibuie Chorals: for 33. Gonverre wropper dass objet Integer fo so delete) remove rewest offribuie req: remove Atteibute (nome): rey: remove Athibuk Cage” )> req + remove Abinéuie C total") Sesstoo otntute ¥ Session atleitofez allecak2 memory i hep se stople fob through auiounkouing Gnceph session object alloaicZ memory a jhe sever and window 20 fhe session atribuies of ir 10 object. J The http i@ one per browser http session abjeck ane visible ancl acessable i all web resource pegrams ef ub appicakon ‘respective of their reqwest and response ebjeds but Browser window (bY Browser twindowtes) Fhey musk get reqest from that browser wfnolowd for which http session object and TeSIPOPI (web application) _ THB Obbribujes ane created Puy sessron obs 22 22290009930 T7COSOEBDECOTD7TE™7TOOOOOCS eceorceooe>ece wm the session abtribule creakd fo Srvi servlet Program wy getting requesy from wrowser widow wl Iz visible and accessable to all’ ofher servier preqeame of woth opplicalton but they must ger request from Same bragser window bt - ft gegsion alteibulez axe gbbol abtribuleg tn Ihe web applicalvon bur they ane gpecfic 10 a browser window C client) to creak /actess Htkpsession object for browser window on. Sevier Heepsession ses = req,-gerSesston(), erealep or ecole UtipSersion objeor NOTED Ths req: gerSessionc) method checks the. availability of Session otgece on server for browser widdes, if available it Provides access fo thar session object otferwise CIF mot ayoilable) if creates new session objecr Cubepsession object) for browser window on tre servlet: session athibutes eae fo creare ses atinivle or to modify ses atribue value ses: serabieibule CoH” , nav TotegerCs0)): yO read ses arribue vole: SeS_ atirhouie airing SI= CBking) ses- gerAtiribue (YaHe2"), anieger Fewster TO remove ses aHribule e+ romoventtrivue Cakr2”): ServierGntext obtribukes een TV Sewiercntent ortribules altacaie memory fo senterGanier object Since Soviet conser aejecr*ane per exe applicaken ard global memory of webapylicaston fo the servierConles! altribuke ome visible and accessable In all web~ resource programs of web applicakon frespeckive of reqwest and response. objers they ae using and icrespecive of jhe browser window fron which thay axe geting reqvesr tic fhe bebw diagram the servierConlext abtvibule creaied in sev) progran ia wsible and accessable th all the remaining Sevier prosroms of web application frrespeckve of the cequest and response objets they one USing and irrespectve af brewster widow from ushich they ane geting Tevest [ebYou might also likeDurgasoft Core Java Latest1111Document440 pagesDurgasoft Core Java Latest1111Swapnil Erande71% (7)Durga Software Solutions Spring MaterialDocument0 pagesDurga Software Solutions Spring Materialpvkchakravarthi100% (5)Hibernate Notes by Nataraz - JavabynataraJ PDFDocument262 pagesHibernate Notes by Nataraz - JavabynataraJ PDFSunil SoniNo ratings yetMagazinesPodcastsSheet musicANDROID - UI - Material by MR Mahesh at DurgaSoftDocument52 pagesANDROID - UI - Material by MR Mahesh at DurgaSoftSumit Rawal33% (6)Angular 6 NotesDocument93 pagesAngular 6 NotesAnkit Agrawal100% (1)Hibernate Notes by Nataraz JavabynataraJDocument262 pagesHibernate Notes by Nataraz JavabynataraJSomesh SumanNo ratings yetJDBC Notes (Natraz Sir Notes)Document175 pagesJDBC Notes (Natraz Sir Notes)JavaEra.com92% (13)Corejava ConceptsDocument328 pagesCorejava Conceptssumanbezawada100% (1)WebServices Notes PDFDocument94 pagesWebServices Notes PDFSunil SoniNo ratings yetServlets ContextDocument16 pagesServlets ContextkasimNo ratings yet2 PDFDocument553 pages2 PDFSmrutiranjan BiswalNo ratings yetBuilding JSP Pages Using The Expression Language (EL)Document30 pagesBuilding JSP Pages Using The Expression Language (EL)Rahul ChauhanNo ratings yetAdv - Java Means Durga Sir... : Durgasoft, Plot No: 202, Iind Floor, Huda Maitrivanam, Ameerpet, Hyderabad-500038Document14 pagesAdv - Java Means Durga Sir... : Durgasoft, Plot No: 202, Iind Floor, Huda Maitrivanam, Ameerpet, Hyderabad-500038KhanNo ratings yetMVC1 - MVC2 Design PatternDocument6 pagesMVC1 - MVC2 Design PatternkasimNo ratings yet10 FiltersDocument16 pages10 FilterskasimNo ratings yetCore Jave by Ratan PDFDocument286 pagesCore Jave by Ratan PDFeramitsaroha100% (3)Hibernate MaterialDocument71 pagesHibernate MaterialTushar Patil100% (1)JSP FaqsDocument16 pagesJSP FaqsbatmanNo ratings yet11.servlet WrappersDocument14 pages11.servlet WrapperskasimNo ratings yetRaj Technologies Core Java Hand Book - 15 Days V1.0Document109 pagesRaj Technologies Core Java Hand Book - 15 Days V1.0Charan Hamsa100% (1)Ramchandra Corejava NewDocument569 pagesRamchandra Corejava NewPrasad Baithi67% (3)2.client Server ArchDocument14 pages2.client Server ArchkasimNo ratings yetBuilding JSP Pages Using Standard ActionsDocument25 pagesBuilding JSP Pages Using Standard ActionsRahul ChauhanNo ratings yet01 Core Java PDFDocument401 pages01 Core Java PDFKASIM INFONo ratings yetSathish Sir Hibernate Notes Naresh I TechnologiesDocument215 pagesSathish Sir Hibernate Notes Naresh I TechnologiesPrakash93% (14)Spring NotesDocument88 pagesSpring NotesSudheer Reddy PothuraiNo ratings yetCore Java Study FinalDocument410 pagesCore Java Study FinalkoliNo ratings yetInterviw QuestionsDocument13 pagesInterviw QuestionsAshok KumarNo ratings yetJava Means Durgasoft: DURGA SOFTWARE SOLUTIONS, 202 HUDA Maitrivanam, Ameerpet, Hyd. PH: 040-64512786Document12 pagesJava Means Durgasoft: DURGA SOFTWARE SOLUTIONS, 202 HUDA Maitrivanam, Ameerpet, Hyd. PH: 040-64512786ShubhNo ratings yetDurga Sir Java NotesDocument32 pagesDurga Sir Java Notesbhushan laware50% (2)K V Rao Adv Java PDFDocument151 pagesK V Rao Adv Java PDFFeleke AfeworkNo ratings yetSpringDocument5 pagesSpringrambabuNo ratings yetArrays PDFDocument15 pagesArrays PDFHariNo ratings yetSpring Natraj Satya BestDocument236 pagesSpring Natraj Satya BestrushikeshNo ratings yetIntercepting Filter Design PatternDocument8 pagesIntercepting Filter Design Patternkasim0% (1)DurgaSoft JavaDocument2 pagesDurgaSoft JavaSANKET BASU ROYNo ratings yetNote of JavaDocument437 pagesNote of Javasteffan RobertNo ratings yetAngular JSDocument183 pagesAngular JSSumit Singh75% (4)Core JavaDocument177 pagesCore JavaKshirabdhi Tanaya100% (1)1.servlets IntroductionDocument13 pages1.servlets Introductionkasim0% (1)JSP-Servlet Interview Questions You'll Most Likely Be Asked From EverandJSP-Servlet Interview Questions You'll Most Likely Be AskedVibrant PublishersNo ratings yetC & Data Structures From EverandC & Data StructuresProf. P. PadmanabhamNo ratings yetJava servlet Second Edition From EverandJava servlet Second EditionGerardus BlokdykNo ratings yetSql Plsql Oracle From EverandSql Plsql OracleAndrew IglaNo ratings yetEconomía Michael Parkin 8e Cap 1Document16 pagesEconomía Michael Parkin 8e Cap 1lismaryNo ratings yetPDF Parts Catalog Tvs Rockz - CompressDocument104 pagesPDF Parts Catalog Tvs Rockz - CompressaspareteNo ratings yetCharles D Ghilani - Paul R Wolf - Elementary Surveying - An Introduction To Geomatics-Pearson Prentice Hall (2012) - ExtractoDocument19 pagesCharles D Ghilani - Paul R Wolf - Elementary Surveying - An Introduction To Geomatics-Pearson Prentice Hall (2012) - ExtractoRodrigo DelBarrioNo ratings yetIndian Express 19 AugustDocument20 pagesIndian Express 19 AugustTension Dene kaNo ratings yetQuiero Quedarme en Tí (Bone 1 - C)Document1 pageQuiero Quedarme en Tí (Bone 1 - C)avalenciavalderramaNo ratings yet2020Document14 pages2020mintrikpalougoudjoNo ratings yet0002 CHAPTER 21 GENERAL ANESTHETICS Goodman and Gilman The Pharmacological 13th - 4Document18 pages0002 CHAPTER 21 GENERAL ANESTHETICS Goodman and Gilman The Pharmacological 13th - 4Emanuela PereiraNo ratings yetInstallation Fitting 2Document10 pagesInstallation Fitting 2solasi.palastikNo ratings yetAmpacidad AlimentacionDocument1 pageAmpacidad Alimentacionluis miguel sanchez estrellaNo ratings yetBuilding ActDocument136 pagesBuilding ActVeronika RaušováNo ratings yetCanon in D 2Document2 pagesCanon in D 2Kevin ClarkNo ratings yetParadise Violín IIDocument2 pagesParadise Violín IIJavier Rubio PérezNo ratings yet101 Problems in AlgebraDocument160 pages101 Problems in AlgebraTrishaii Cuaresma97% (29)09 - Chapter 1Document20 pages09 - Chapter 1Dr. POONAM KAUSHALNo ratings yetBusiness Startup Guides-Preparing Yourself Ver 2Document4 pagesBusiness Startup Guides-Preparing Yourself Ver 2Minh Huỳnh100% (1)El Pastor - VihuelaDocument1 pageEl Pastor - VihuelaDamian Guardia SalazarNo ratings yetRoot Objects - Alfresco DocumentationDocument10 pagesRoot Objects - Alfresco DocumentationpmrreddyNo ratings yetRollupGroup - UpdateMembersDocument4 pagesRollupGroup - UpdateMemberspmrreddyNo ratings yetUpdate Account Status On Enterprise LevelDocument33 pagesUpdate Account Status On Enterprise Levelpmrreddy100% (1)Using The Javascript Console For Development and AdministrationDocument26 pagesUsing The Javascript Console For Development and AdministrationpmrreddyNo ratings yetMediplus CardDocument1 pageMediplus CardpmrreddyNo ratings yetGet All Alfresco Tags With CMIS - StackDocument4 pagesGet All Alfresco Tags With CMIS - StackpmrreddyNo ratings yet7AY W Ag@Pbae D ? 2) ) - H A'D Agc@Pba BCDocument4 pages7AY W Ag@Pbae D ? 2) ) - H A'D Agc@Pba BCpmrreddyNo ratings yet
this cg reg: Mtomializanton lege of Servier@ofi¢ obj lotr ©; 7 public void loft ©) emply method t 3 pyutre Sevleranfig gerserlerenfeacr f aekxn cg: 3 = other methods uy MOTE! ay prede fi « 0 @ on efinecl HEP Seviet class there o7e 00 fatkC) methods TestSev: Jour Cour Servier Progrom) Public class Test&ey extknds Generic Servlet /HetpServier 3 Public void torr 0 3 > Progerwner choice tniialiZakon leyic Ike crea 4 Goonection obi ecrecceeeecccsgoe@eoggoogcooo nose aecosonsas39009900990905o po o oO a ° oO oO o oO oO oO Ce ceocecec poolic void Service C SReY rev, Shes res) Hrows s6 , Toe 1 © request processing logic a ‘when servier GonFainer raises fhstankation event by Createag our server class oaject then contacner callg Toft C-) melBod but nok fnft () method Go ofr) melbod 1 called as lifecycle method and init ©) Mmethool ja nok [fe ude method- 4 With respeck 19 the above Code @) End user gives first request to our servlet prograry @ SerwletGonhacner crealtg our server class object CTestsrv) ond also creakeZ one serylerG@nfig object. @ ServierGotainer call fork (-) method 92 life cycle method by feapiez servier@nfq object a argument value, on our Servier dass object (WD Sioce fotkC-) 18 cot ovaclable fy our Servier prcgrarry the SuPer Class (predefined Grenericservleh class) fot) method executes (5) The super class foft(-) method fnikalizes tee received Servier@ohg ORK In GenericServier class ond calls fa?kO) method. Since farecy method i2 avotlable 7 ou Servier program that will be executed Here programmer places hiS serviek program related foi ttaliZahion logic ©) Servlet Corainer calle rexr lifecycle method called public void service C-)on oor Servlet class object. MOTE! Zn Scenario G) programmer need cot to Cenkig ebjeck explicctly fo his Servier program: more ever we can cou gerServierGoFg © method te ger access to servietGnfig object From ony lifecycle method of his sarvier program» Sc eratio @) Generic Sewleh Gouro- Psat 08 abeve ale 10 scenonia (d) tclwbitc @bsiracr dass Generic Sevier feoplemen'S Servier Servier Confi'9 99> public vod fotr € Servier@o9 <9) F niseege as foth 07 a public void fort ©) { 3 carver Public F peurn ga; 7 > other memos 3 frother meth a @) @) eStSry. java, Cour seevier prg} Puelic class TeskSry ewend? — Gieneric Servier /Htep servlet 4 Seevler ok 09s public yord torr ( Servier@ofrg 0g) bw ARis-cg= 69: = Programmer choice tniklaakton logic like creaking — Sdee Conneck'on obi J Public void Service CsReq req, cRes 25) throws SG, TOE ie ——— reqest proce ssiog fogie 5 a * Here 1, @), G) aNe same as gy 5 ) Public servlerG@of9 getServlerGonfig (> nein 8 4 <= Fother methods 45 Te stsev. java. (our Servlet program) Oy Co Ole Public dass TestSrv extends Hcp senvlet/ Greneric Serviek 4 public void fat (sevierGanfig 09) gow 25 W Fragrammer choice inital zakon lagic like create jolec connection super fof} ©) 3 Prone Void service CservietRequest ct, Servlergesponse tS) thems an, ree 1 6) eeqpest processing legic ny(0, @).@ sees of SKenario®) axe Same af 7,0), SKPE of sceranu’ ) thik C-) method of our Servier program eaecutes © Gecouse of superinit Cag) method call he super dass (Generic Servlet) Tot (-) metnod executed 6) folk) method of Generic Sevier class iholi3es the ServietGonfg abject Cortasng Servlet Gonfig — fnittalitahon togic @) since init ©) method 18 not awatlable in 00r Servlet Foire) matted of Genericserviet class will execule- @ same of stpG) of scenario @) NOTE 5 method coll fo ger ServietGonfirg object - i) 2F Programmer forget2 to call super. tnt (ca) method the Service (~-), destroy() Tfecgle methale con not get access to Servierantig onjeck even after calling gerServierGonfigt) method +t The besr Scenomio fo Keep foi C) method fn our servier prograro 12 Scenanio @) Coverriding¥ jotted method) pluayz give chance +o execute fofkC-) method of predefined Greneric_ Servier Class during ou servlet dass insronkahton and fnitaliZahton Process: Becowse #hi2 method conkaing cervler@nfig foikali takton logic ard makes Programmer not performing that works eeph ‘y wry servlet OPT has give methosl when fr iz rot Iivecude wethod 7 : > Re Rr the 4 panagrophs of fit) Ye tote Csenvletcanfig ca) discussion of page 00-55 of bookler. +9 Sood senile programmer always overrides int) method in his Servlet Program fnsicad of fot > methed Cfotiow Scenario 9). x IF class methods and — super class Public / protected rnethod2 in Suts loss can be called withour object 29900 9e¢00C090095 2909 eceseccoeecce 7 O0eoe20OO50"Meo cece oes Th ony We cycle method of sevier prgrom Th ory NE NS ez Servier Gon Fig cg = gerServieh@ofig 0; gives access fo Serviel@ofg obj ab ts op mathod of Gienenie Servlet class 29 iF can be called with out olejeck tn our servlet programs understanding 40. Service c---) methods and seven doe (-,-7 methods of Predefined piekpsevier class we can use one of the hoo service G-) methods or one of the seven dokexC;-) methods fo place reqwest processing losic ty our senvier prograsn but only public servicer) methad 15 We cycle method ef servier program a —r——C—C public absirack dass HetpServiet extends Generic Seevich public void service CservierReqest red, ServierRespanse) Htraws Sb, TOE & 1 iype casting heepservierRequest hreq= (WetpServierRequest rey) lcepServierResponse hres> CHetpservlerresponce)res ealls protecled service, -) method serviceChrey, hres>; 4 Tproiected service c~/-) | seeicac-r-) method? PrOHeceD void service HttpServier Request heer, Het pServietRegonse hres) re dheows SE, TOE Peeads fhe rewesr method of given reqpect Siring method = req: 9k Method); Ucalls ene of 4 dokse(-1-) methods based req method (F Crnetned : eqnsals C~ GET") docet Chrea hres)/ else if C method: equals(*Post")) doPost Chrea,, hres): else if Cmethod + equals (*head")) do Head Chrey, hres); 1a37 Prokected void doGek CuttpSevierRequest brea, HetpServiet Requesr hres) Hows se, TOE = loge send yos error response. fo browser windod Protecied void eloPost (Heipservier Reawest rev, HerpServiet Response hres) Throws $6, 106 logic sand yos error response to browser window Diraplementation of ober doXxe(~n3 methods Sending 407 error response 40 browser windlout Aedass Te stsev:joua Cour Sevier program) eee ee a os @ Public dass TestSey ewtends Hetpservlet Public void doGek (Hep soVerRequesk rea, UEIPSerylerResponse ces) ——— ow requesr processing logic wilh respect 40 above code () Arenr gives request Yo Ur serulet Program having ‘get’ method (2) Servier @rpainer creales 6r) locales our servlet class object 1¢ created SerVier Container a)50 comple3 Ye Sitio ZaHon process: 13) The Servlet Goburer creaks ServiehReqwest, ServietResponsé objects for current request ond tolls the (if cule wethod public Service oo0e00oes 9090090999093 neereneoooors DSOOCCOOSOOOOOS» dass object: keeping SonvletRequest, SevlerResponse objects as apgunent > volves + (W Since public Service(--) method is nok available tn our servlet program, the super dass public Servicet-) method exeuules Cpredefined WbIpservlet class) oO This method Converts ServierReqest object fo HtipSevietReqwest object, SevierResonse objec jo HetpsevietRespase object and calls prolected sewicee-, ) method having those objects aS anguments: 6) since protected Service(--) method 1S mot available fn our servier program, 0 the prolecled Service C-/-) method of super Class (Predefined lttpservler clos) exccule®- Th'S projected servicet-/-) method calls do Ger) meticd based 9 on “get” method of given request (@ since doGiet(-/-) method 15 available ft our Sevier rogram tat will be oO executed and generated response qoes to browser window NOTE? Dork let doxex(-r-) methods of predefined Hbipservier getting exccuted dtceckly @r fodirectly, because Rey send “4os' error response to browser © yindow fedicoleng that our servlet is Incomplete servier program towards © Processing request - © pwwhen reqwest omsival event 1S ratsed (means request Gomes fo Gntainer) servlet container calls public service(--2 method on our servier class object © and TF never calls profected senvicet:-) method, doxec-) methods for thar event so only public Servicet..-) method iS called as servier life ycle mettrods proieckd serviceC-,-9 and dotexc-1-) methods ane calleal Convenience, methods given Jo progrornmer fo Keep request Processing logic to our Servick “) Pregrarns: YD -Rfor understanding flow of execution th our servler proproms towards vu the request processing refer the Six stenamios given fh page no. 86 of bool + Regiskering web opplication in ONS egISWY iS nothing bub keeping’ domain name cf web application along with home page URL the TSP machine where ever webagplreakon hosted will te hauiog stake/ fixed 2p adress fence we purchase space from the Server of Tep machine they supply Ere application olor with user aome and password “and we can use, thor Fre application to inkerack with Our Space of TSP machine from ony place 90 using nis %e host or move web applicakens 40 the server of TP machine « Flow of accessing @) End user Yee — domain nome as UAL in browse Windows odes ban (lo) Through infereel nekwork 4h2 request goes jo DNS regishy, gathers home page ceqesh URL of ven domain name. (KC sata cn) fron DNS regishy (@) Based on home page reqwesr URL fhe web resource Program of hosted web applicakon fh tomcak Server of Tsp machine will be executed G) the web resoures, prograr generales one web page to browserwindo? FW can add BF remove web resource programs 9 jhe hosted website of TSP seever fiom eur local machine. through FTP application. (This is nothing but updating web Pages Content aftr hosting) ives”heep requesr methods ast Post Heo ewer puT TRACE oprions The regulary used WO reqwesk methods of ceal world protrrenig Gre get, fosr ger: #GIVen to gather/to ger more dole fom the server the cesponse of HS method based request Contains both headers ans Sy Hea Head: ¥Sorne as get bur his method based request Jenercted response antains only eesponce headerz- KThIS method if Useful fo check He avoslability af wer «esource Programs. NOTE! GetC) Method is Usefel to gother doko from server by soning limiter amount of dora Cupto 236 kb) from the request: #DeSi9n 40 send Unlimited amount of obra along with the request puts yuse ful to add OW web eeSoUrce Program fo Woh apelicaron from clear delete tuSeful 40 remove WebreSeurce program af wel application from cleo More? pur O, oleleke ane Useful tn the olevelopmenk os ETP applications. opkoos server delenines USIO9 cohich request metheds the cLirrent web cesource progeam Can be requested: Note: TE oor server Program Gontains docer() method overnding then the ophons request mithed based eaLeSh given fo thar Sevlot Program 22eco0900900 a¢ eoococscoo ecorcoceccec«Go celoing ger Head. Trace, apttons oe RO Trace request metro! based request deracls of contazn web reSource Progra can be Used for debugging operakon# List of frm Components fn form pope eae eee rex Bow Q) Passuora! Box! ©) select box./ ComboBox © List bow @rearhren © Radio Buitaes (2) check Bow Seols the Flow of execution like server. So these details ©) bolton (Stondand button, Suemit button, reset butON) @) File uploading component Ten Boe tle form poge Name: 3D Servlet progrom Cfo cead comp value) String st= req. get Rariamekr C"Prame")} Password bow ae form page Pe: < inpur NPE =*password™ name.” page”? Jn servler program Etrieg Sim req. ger fonameter C'page"); exr Area inform page Address i enke ur axdress lotBn servlet Program Cto read component vole ) Sting siz rey. gerPanameter (“taddress’); Select Box (combo Box Callow US to ereaiey selec one jem a time) Qualicoki Gicohon : < celecr name =" alfy"> 8-E/BTech option, MBES C/ophoris 2.0 f0_servler_ program String si = req. get Rammetrer Calfy"); HK ebile workerg colt Select Box the celeded tem will rot come fo server aS requesr parameter Value, Ihe Valve available to the value alleibuse of option Fag for Sdecrd fern will come 10 Server as request parameter valve: {41 from the above Select tox if Bé/tech IS choosen then the valoe 2999 will 90 fo Sever as repest parame yalve List bor (allows us to select multiple tems ata Kime) eres eee! ati ee Inform page Courses: NET pKa envler_pregram options String SCI = req: gerPorameter Values (“erst); x TB 70WA PEG, «NET PEG ims axe choosen then SCI holdes 5 . Soe eS elementa values ee co0@ececeoosososecoaect eccerroooec:9 9 9 9 © oO oO oO oO oO oO oO oO a ecocececoce: Radio wins Ee giieg some name for rultigle rasio butions we can group them untk: So only 002 radio buHon can be selecitol ar o hme: folo Single sin_forn page Gender: mole fobsp; dobsP; Femole ln Servier Program ghing siz req-gerPomameler(“3") } 7 gives mM when male cas is Selected M9ves — when female casio is sHlectesh checkboxes, pushen multele checkhxes ane grouped cto Single nik by giving some nome then We can select multiple checkBoxes at a time a Hobbies : Reading Jove wets —r web applicalion + meer —> Proje Name : [focmoep peek —y server: [elastFch 2.1] —7 neat —? Finish SEP@ ggg form poge fo the proyect (Details. html), Right click on webpages folder news —> Hemi > fy1me file nem, - Pioish peoesoscecocoerssoe9gnocce0¢30607999007 ¢@neoroeooeccoO oO a oO oO o 0 oO Ce occ ccccc. cform actions *for\* methad > “92> oe! pares Sf Formsey Servlet program Home: ce Age: cinpur types Vea” Dome *PORED siiey Leos, eb/R ech spun Pls MBBS &-A B-se reading 4nvsp; 4065p Rooring EnbsP: 4nesP sleeping Kidz Address Slext area, name=tdress” cows= “Y" cols:"20> eniee addieess chp < inpur types“ submit” value ="getdetadis’ /> ¥ merges Iwo Cells into single cett Shep |: Add formSrv Servlet 10 Source packages folder of profect Bight dick on Source Podeages folder —> naw —» servlet —> Class name :[RormSev) —> neer —> vel potiern: fur) > Finish 1OTE: The above TPE generated servier Program Gives ProcessRequest<¢-.-) method 1D progrommer for keeping request procssing logic ard this metmod wil be adlled nkernally from doGet (--) , doPastt---) methods tke efpeaach (3) of developing our Servier program aS flexible servier propram (Re Fer approach (3)) 2) a 19090930 a200ecseceacs3 »Ceocococoosn eeseceocootes:ecc cr peec a. us keep the following request Processin? logic f0 frotessRewest-) Seclbed =f oboe ce hee Pgenerad seriegs Printeariter Pus reS-gerlriterc) 7 eS: setGntent Type (“teat phn” )+ weead feorn form page String ame = req. gerPanamey (“Poome’ ); for ages Foleger: panselnk( ref: gePonamerr (‘pag 9); Sing gen = req. gerPanameler (9°) string Yfy + ren get Ponameter ( “a1 fis");, String SCI req: getPanamelerValues (“ers"); Steing heC I= red: gerPamameterValues (ch I") > String address= 029: gerPoromeer (*toddress'y; iF (gen equals (“F")) 4 if (agec:%) pw-printin (name +"U baby girl”): dse if foge<=12) Pu print (home t “Ue child giel”)y else if (age<=19) Pw .prickin (name +"Ur teenage gic"); else if Cage<=30) Pw.printin (ramet “ue a. yang etamaci'), else if cage<=45) pusrprintle (name+” or middle age women); ase purprintin (name +* Ur old fady"); ss else if (gen ewals (*m)) i ig coge <= 5) purpeintin (name 47 baby poe); a (+4Bokece \sivearn oh pernrciasaGy G S ypsor fern datov a Pw -peintin(’ age =“ 4age); oO Puxpriotlo ( Address =‘ + address); 4 pas: Priotio (" Gender &* +gen); pwr printlo (Cebrp Qualification = 49) F 4); Pw: printle (Yabr> Courses ="); For Ciok F: i< crs-length 5 441) oO i - Prprintin Cees CII4"....* oO 4 oO Pu: priotin (“ hobbies =) 5 ° 3 Gor Crok $203 I< he: lexgth: 441) : ; 0 Pur peictlo( heLEFJ 4%... “); 3 c blo se sleeor obj 2 Peo close C) > a oO 3 oO SHPO) + Run the Project . Right dice on FormApe Project —p Run : we can prepone wer file on deployment directory Steure of web é ofplicakion Each wom file repre sent2 ene web applicakon ‘ Procedure to Prepare won file C eee eee ee a on - 7 PPPs e — ow eeree 27 ° [> vorer Ape = —— fe ° WE8-103F - ec c j > classes > perguist bin! ' eee 2) . | coep- ren > myf aso sou) ue .© oO oO oO oO oO o o ee To prepare wan file eS @4ps\ vole Hepp Jon cf Vener. worn - Gives Wor file by Canbining everything of Voteraep feller. There ane 3 ways #0 deploy 2b applicokons jn servers Chord deployment Copy wor or directory of Web applicator to a Fined @ insallation folder af server soffeaane Jive Tomcat.home\woeborps foleier)- @) Console Peployment (use admin Console window for deployment) © Tool based deployment (Deployment usieg Ie0lF like Ant, owen, 20 +) is cedommanded process Procedure to deploy webopplicooo i> Temtor Server through Gonsole_déploymar process Step) 1 Prepare coor Fle CVtApp.war) as Shown abwve Step @" Lownth “Tomcar tech applicakes manager window stont femacr Server —p lawnch home page —? Temcak manager —r Subir user name password BPG): peploy the wor File coment web application manager window —> Selecr wR File 1 veload —> browse —> saleck the above vere. evar file —y pepley *Test tre opplicahion by using the following request UAL neep! //locolhost : 2020 /yLoee [personal htm! ve West file Mame a8 Context path ore: 3 NOTE! In mwst of the servers when umn File is deployed, ita file come whomarcally becomes Gonlext Path of the web application # To perform bard deployment of web application fa tomcat Server copy VolrneP Rider a) YEPRP-eDaN fle to fomeat-home\ webapps folderweblogic jupe + GpplicabonServer Siw Vendori BEA Sysiems CoracteGerp) Version: fa3 Cdompatable with jdk 6) @ermertiad Sa defoutr porr 90! Fool Jon File hak represents whole Jee para apiz . weblogic: jax fo dowsload sofkoane : www oradkeGom 9° wWUW Commerce -bea+Com for doc8: wun: edocg bea-Com or wari’ oracke: Com allows to create domotns . each domain act as one opplicahion server. KIP roulkple projects of A Grpany ere using Jnen weblogic Sho will be installed only once fo a Comman machine Lor foe multiple Projects mulkele doraing will be crealed In thar so posedure 1 create user debine denain sever in weblagic 10-3 Stoat—> programs —» oracle weblogic —t Quick stark —> Ger stonied with weblogic Server —-F create ned Weblogic demain 7 next —> Grereate a doroato oer pemein name. Adv Java BakchDemot “= neak 9 User name « [javabass) password ‘[Jovebasst] Gnforn uSer password s [pewabess —+ nant —> Selec Adminshakon Sever —y oer —r Listen port :[ ora] —> neat —» create pplication Server = wxb Server ETB Gnrotver f middle wane Services 0052990G09909099995995 70090 eacsoanaeceoecercoecocogegeepplicaKon Server semgene | seourtey [ee Gon pooling | coonieg J clestering Servier Gontozner Tsp Coohoiner EIE Gontouner REI s0eh KEIR Cootammer iS required Jo manage and exewile 78 component Wor file —» webapplicalion axchive Creprasents web applicoivon) * Jon file —>Jove onchive representa java api/ ep File) + €0> file —> entiprise applicatton archive C Son File+ won file+ jar File twanfilet---} Kram file —presouce adoptor achive ( represents a fee application jnlerceting with srebel/ sep so) war 1B the difference bekween webserver and applicalion server? web Server opPlcation server (atROwS to deploy and execute web (9 Allows Jo deploy ond exeqwie web eeplicakons, 63% Components. Gnterprise eppiicakiens and resource adapkr offs: opplicakong Q)Developed based on servlet, asp apr (7) developed based on all gee api Spec FreatigaS Goves senvler Grrainer, 1p anioier. — waives both sevler Grtaine, ip Grtairer ord ESB cintainer §) Do|sH allow 10 ertare domain W Allows 40 creole domains © Allows oly Http proieat request © Allocs# both HELE and nom Heep Crop, 73 ond ee) protoed based request © Atves minimum oo of roigdle wore PE GIVES more no. of Inigsle wore Sonica s, services: mi° @ cvitable for smell stale and medium @) suirable for fage sole webs Scale Web appltcakons appltcaktong anol for TES applications. o @Recagnises -wWar Fle as agplicokon —@)Recagnizes -wor, cor ejon,-ror CP Files a@ applicakons @Er TWS, Tomcat, Resin ond erc. fd Ex: weblogic, websphere ,Jeos¢, Glass O Fish and ete s Procedure to perform the cnsole deployment of web applicakion Advi bat Hf a Weieeel en a SHPO: frepone wor file representing your web opplicaion tike Vtppp.wan 5 SHPQ) stant Adv jauoBatchDomein sever of web logic. refer Fee dass . Sram —» Programs —r Oracle weblogic —> USer praject2 —> tavabauaselcroonning —? stork admin server for web logic 2 SPO oper adminsication console of ihe above domain server GS open browser window —> type below URL 7 http: localhost + 3049 / Console a vsername: javaboss 2 pasesord ! sovaresst ° SPW! peploy the Web applicakon through admin console 3 °o Admin console —> envicorment —y ger Deployment —> fostall —> upload your to FileS—s Deployment achive —s Browse ord celcct viemp-conn file —S ou net —p ner —> nexr —pnexr —> finish —> save wrest the above deployed web application Admin Console —7 deployments —> launch veerpwor file —> Select personal-hm| File related URL (1 eedepley the Web applicakon In web legie Admin Gnscle—7 dephuments —> [EB VEArP — ciel ees-cecoscec:edD “To perform hard deployment fo fAdv-javeBatchDomain of weblogse secver copy webapplrcations directory on ite Bar FIC 4 oracle weblogic CYolereep) cvmrr) home \ user. project? \ domains \ autodepley folder * when wor file i wed for hand deployment CvefpP-wor) Use the following request URL Jo Lest the application. i) @o) a) 2) 9) 0) @) ete: “localhost : 3070 / Vener / Personal = html * The web application thar ie deployed in weblogic server trough 1) hand deployment Press can sot be undepluyed from admin console. but con be undeplayment through hand deployment process itself, O when wep application je hard deployed fn web logic server through direao- 8 ry based hard deployment Ccopytng voterArp foller to autodeploy folder) then O vse following raquesr URL to test the cpplicanon > > he Lp? /Mocalbast + 71070/ vetec app! Personal: bree)! oO 7 oO Directery name a8 Gontexr path ° FIN uxb logic server when you modify the Source ade of Servier O Programa placed in deployed web application, just oompilakion is enough 10 ger the effect of mod Firakons and jhere is 0 need af performing Othe reloading of web application ~The web appiicakion and jr Web resource Programs ifab ane pons rlolve URLs i= called a LwoDA applications - ft Gach server Suplied Seperate implemertation classes implemensing \eovous 2 foterfaces of Servier, ISP Opis but we never specify these implemen oO iS tation class names fo our Servier programs to moke our servlee Prog roms ws oS wore programs - v 4) Glass sh ; = type: Application server 5/0 : Vendor! sum revere sy shen S Version. 2% Comparable wit Wk \-¢/15) vu wtopen source s/w Bllows to (reat domains: pefauit domain is domain} Jom file thar represents all Jee opis: Javaee-jax defaulr port no: gool Cfor accessing web applications) 48U8 (for accessing admin ansole) The Glassfish 2X softwane thar Gomez with cebBean® 6-F-1 Toe can be Used with or without IDS Procedure fo charge ihe default ete probes! service elated portno & doman! server of Gdass Fish 2c —EeeEEEeeeee Go to Glassfish. home\ rep Server domains \ domain! confi9\ domain.) File, and change fork ottribuie value of fiesh bog Procedure to perform console, deployment of web applicaiion tn domain —______ — amr’, SE lication In dorains Seever of Glass Fish StpUD! Prepaning war file cepresenkng web opplicaton lice VERE war 9: skanr domaini server of Glass Fish toa —» Programs —7 Sun inicro Systems —PeRplicalton Server—> stant default secver SHEPG)? open admin gnsto Console of domain! Server open browser window —> type het pI / localhast : 4848 usec eame « [asain] password Sladmin aaein] sep ld? peploy the web> application Admin console —> apelicahions > web applicakions —> deploy —> type :[ Wee applicaren CHa Ty beaten: srowse and selecr VEARP: WAR —polk 5pSY Test the web application open the browser wird — type below URL http! //locol host 5151 /VEORP/ Pecsonal+ tre | wan file Pome as coolest pakh _ a a eocccu e090 osce ccoces eceectbecooogc.SSCSOESOSO SOLE COCOSCOODOODDIIIDIIIIIHIIIIIIIIIIIIIOD Hethe Glassfish server support only wan file based hard deployrnent and if does not support directory based hend deplayment. Procedure fo perform hand deployment of web applicakion th GlassFish 2-« Server: Slept): create wan File representing jhe loeb applimtion (ike veAep-w0r) slep@i stant domain! server of GlassFish Shoat —> programs —r Sum micrasystens —rAnplicalon server —> stant default server: SepG) | pepley the web opplecation cepY the above Vknppwor file 10 GlaSsFish_tomer\ empserver\ Domain SS domain! \ avtodeploy folder SKEW): rest jhe opplicorion open browser window —r type below UAL. beep: / locothost : S151) VEReP I Personal: hin) + Wan file name aa cone goth “Euhen fore page suemir button is faken with logical name then the, caption of tne emit buon will go 10 Server as reqest paromeer valve olhercise Submit button capion never goes fo server as requesr parameter vadue- Ainpuk types" Submit" nom gloput types * submifY yolues “check” > SI foren> Neve: vere relad fo Submib buten ro vale wilt Pooorreler value - 90 b Server as repest ASResolf Result 13 6-10 reste issace | is: 30 to handle the above form page celated request Processing give Some name to all the three submit buHon& with diffrent capkons and use thar caphon OS criteria value tn Servier program fo differenbale request processing logic’ for €adn Submit button: foen = hi) ger’ > B value: ; dead form data fok a> Toteger-panse nk ( request.gerPamameter ("bi") ); for b= Tnteger. panse tnt (request: gerPanam eter (tay); meead caphion of submit button Siving Cop = requests gerpanameter (*s\" i Cea: equals (“anid”) Pu printle C sum fs en result is” 4 Caney RO-Printlo C add bin 1s clicked"); a else IF (cop-equals ("sub") ) ¢ perprintio ( result js : Pu Printlo (° sub bin is 3 else. 3 PO: Printle Cresut 35:4 Co/by): Purprintin (“div bin 1s dicked”y; 1 Jelose. Skeam obsecr pos-close(); 3 a Web + x0) configure TeskSev Servier program with gebyeon age -bhol (static web fom gerpate —_| + Ca-b)); licked); crestere! sTestScy (server fray serine | 4 FF! Hordtiog with moltple Hyper ok PayPage-hhe) foam aettory=/” cer> Qed Stig cbr? geritme Calendar: gerInstance() Thre gerTnstance() is Shake wmethed of calendan class returning one Sule dass objet of calendar dass ag rebum valve. Calendar dass iS an absteact elaSS- KT, tre above Statement cl is mb the objet of Catendlan class th is one svedass wbJer of Cdlendaw class. —forreshtra| Treat patiern of FestSrv Servlet Prearom A value B value getSysdale TeshSryjovor Public class TestSry extends HttpServier : 0) Prokecieel void Service UbepSenvieRawest request, MbtpServierResponie, respon Hows ServierExee pon, ToGucephoo Wqererol) setieg® response: S-Goterh Type Cent /phol*)i Printweiler pws response. geruariiat?, Jeead $i ref, poyamerte value String puals (equcsk. gerPanameter ("51"); More rey. processing logic based on hyperlink or submit fiputton en that iB clicked 1f Ceval- equals Cadd”)) wif add vin js clicked t fread forn dota: tok Oo = Integer-panse Ink Crequest SetRon ameter (*t/") ); inl + Foreger - pansecint Crequest. 9b Parameter (“3° )}; pur printly (sum 132° 4(a46)); i else if Cpval equals Ctinki*)) IF — hypertink is cliched i Dae denew pale (1; Pu-printin ( Dake ig 4d); y (close Streom object peo dese05 CeCe eceooeeosccoeeee08600000000900900999909993993cee. 9000035590 ceoccooooqooors Cecece ecoece web-0} previovs applicakton identified through it8 URL poten accerding fo There 18 a possibilty # same OF ee Seviet Program is senior specification gE by Sun mior SySlerne of giving three fypes of URL patterns WW) Exack march (2) Directorymalch &) Guension Malt Exactmatch p URL pattern beging with 7° symbol and Should dd Gaohain # Symbol x multiple fords can be there fo the URL Palen seperated with °/" symbol Bx, In webs /iest | “url patterns request uRis from browser wirdlow) fo requett jhe ahove servieh Program pttp:/ localhost: 2029 /polenep/ test (valid ) http *// local ho St °2020/ pak.Aep hyd ESE! Clovolret ) Jdakeep/testi/abe —— Cinval'd) {rast APP Jadee 2. Govalid ) x0 curl ~paHtero> /test{/ abe SB) fae /lest/ 2% 228) rest. cpp The uRL Patten frovided for servlet programe can hide the Servier technology ond the class names of servlet programe fram the entlusen? of the websites THS gives TitHe bir prevention fer ucbsile fe website feom heaccere and jackera» —fDirectory Makch The URL pate must begin with "7" Symbol symbol and cen also fave multiele words seperated Exu) s Hest( (xyar/ * request urns fom browser window to request the above secvier fregrom . pla oe i paca ree peep: Mlacainost :1020] Dakepep/ fest faye. 1 /abe Ppaserep /xyry/ jest) / ose ord must erd with % with 7” Sgrabol - (valid) Zrarenep / 36861 frcys.t / obe-< ¢valid) [rareAeP/ oxJy] test do Joosenpp/ lest! (ey 21 7¢babeanep /}esty olfer example diretodymatch UaL patterr eati< ucl-paberny X14] # ends: cucl-palen> Jabe /aya/* + abe O Ge Bi Ka oO O *we can rok prepare ORL pation ef a Servier program by ming ° up routrple styles because all servers ane designed fo jus recogrines 7 only je abae 3 sivles of unt pallens o /ay3 fobt/ #-abe ‘ v c Tivalid URL gatiern formation a Af fo servlets ane configured with Koo differont siyles of vAL Fo potieros = I"ke exacr march and exknSion match if matching same, Oo ~ Rquest URL given by browser window then Sever gives Yengackan priority © to exocrmarch url pattern based sevieh a o Example sceranto oO ‘In __web-mml oO oO Date sey ———? Bit esto ue patlere (exackmarch) Dake Srv ———> with /*-do uel pattem — Cextensionmatch) ree p? //ocal hast | 2020/ DaleOpp / test-do v This Hstdo matches boty paleSey, Dak Sev) Servier prograrn bol priority will be given to aecey Program wilh UaL paren exact mabch. MyBclipse = Eclipse + Built plugins fo work with advanced technologies * plugin Im paler sofware or Software opplcation Hat can etn ernane the forcionaiikes of excskng sw and Sg applications: Bin Jawa environment plugins come a& jon file: In toc soypoanes ply ine provides witonfe to dewelsp Sto technolowes based oplicahons ecccecececcescoocgoo0ng inwher id tte difference _beiween Eipse TDE and MyEclipse IDE? eclipse Myeclipse &) open Sourte, W Gmmerccal (2) Provide? environment io develop @) Provides environment to develop sé module application® 386,566 and f — based aplicatrong. 3) Does not provide bwilt-in plugin GB) ar Providlez uilt-in plugin 40 10 work wilh advarted technologies fork with advanad —lechrologieg we test prem supply them rmonually. and alge allows to add more Pluging expliatly. () suitable fer stall scale companiez - 4) Suitable for medium longe stale Companier Basic foformakion of myGclipse Type ¢ DDE Sofkoane for Jawa enviconrnent. Version: 8-2 Ccomparonle with dk 16) vendor: Edipse organizakon, Gromercia) sofkvare Seale. ond Govep tomcat a3 built-in Server: But alga allows the Programmer to Configure other external Servers. to download software ww: myetlipsesde- Com for decumentB ¢ www- myeclipseide- Grn Myéel hear code + Sub seriber ¢ goclo: Go Subseripion code: ELR BZ ~BISUYY~ 6666535737876 142 + ed giver based en cdipse Tne Proceciuré_to_develop below application by using mmytclipse 4 SHPUD' Lanch my Eclpse 206 Ly chosing one. work spate save the projecka work space: E:\mybclipse 8-% Wpse Geleelio, 6G Eclipse ane alienate Toga for mybclipse which one pe folder io preoscacaco9aDea2000090 enecooocccoeooexre0co0es ecoee Cccecccccc Formarr) Poem Sev(Servler ) SP@)' Submit the cheat Gee Myeclipse menu —+ suescripton fodsenatton —> Suoseriber = Bobseriphion ade: [=== SEP): create wee Project fo mysdlipse IDE —— Fish, File menu—+ New —> web Project —> projecr name: [Famaneel) — fiors Goiexr root vet: [7 Foemepps (ata SEP@I! dd form bil to web rook folder of the Peoject Expand Project —> aight clig on web root folder —r naw —p hho} > Filename Soren. ntrol © Stoem reethodd = "get" acton =“ furl” name = "FI" > Name: Geeder’ # bos server Program fo fhe scr folder of tte projec Right chick on ser folder —y new —y servlet Name: fornSev —> select doGet,doPosr methods —-oeu- —7 semler /T5P reopping uRL: / —> Finish SHPO) 5 In the generated FormSrv Sewlet keep the following logic ard call thar method * In Forney jauoy public void doGerC-.-> throws sé, TOE W general setkings response set@nient Type Clear | bral"); Priotwriier pw> response. gerwrifer (> > read form datar String name=cequest « getPanameterC“Prame” >; for age = Integer. panseIot Crequest. get Parameter page"); Shing 92n=reqwest. getPoramerer( “gi"9; if (gen. equals Cm")) . if Cage >=21) : Pw Peintin (Or rnamEe tue eligible fo marroiage") 3 else : Pua Peiokla Cmr +name+* ue not eligible to morriage”); 5 SMF else if Cgen equals ("F*)) : if Cage >=18) : 5 Pa-priotin (“miss"+ came + “Ue eligible 40 rmanrie3e”); 3 7900009009929009090 eeceorecooceccecoa0e0000nesgog000cc 00 coooococ eececceoece dse * puo-printla (imi ss” + nome ‘u + ook eligitle to manrioge’} 4 jyase if JjudoGer C1) Public void doPosk C--) rows s6,106 4 SEP) Goftgure Tomcat 6-% Server with myecl docet 1-05 Wse Ide window menu —> preferences —> myedipse —* Server —yTomeal —7 tomcat 6% —— Tomcat ——x Tomcat—home dliredory ; p:\Temxah 60 — apply rots SEP)? stant ihe fomcar Server fromm myStlipse TLE Go to servers fcon tn the feel ban —> Torncat 6% —rStant ske@)i peploy the above project Io Tomcat server- Go to deploy (con of the fool ban —¥ project Formapp! —r aud carver “omen 6%] —» [Finish] —> GE) SEP@): TeSk fre applicakon ‘open browser window —e TYPE thie URL beep +f localhost : 2020 /Forn one! | form -hhol J Procedure fo Gonfigure Adv-jauaBatchDomain Sever of weblogic 10-3 With My cdligse TDE: Window menu —y preference’ —T my eclipse —r Severs —y web logic: —> weblogic (0% —? © erable —y BEA Home directory sc: \oracle \ middleware Adminshotion username: Javabess Abin station pasucord; javaboss} 9aExecution domain root ? @: \rmiddle wane. \uSer— Project? clomacoa\ Ady. java Batch Bormain — epely —rokK Procedure to configure jhe domain) Server of ‘Glass Fish 2-4 with myedlipse IDE: 220099095 Lindow menu —> preferences — mycdipse —+ Servant —? Glass Fish + GlassFish 2% —* © Enable —> Home-diredory : Dt \ SunsPrPsever—z Oo peel —> ols: © o If mulHple threadg ane ackng on single vanable 6) obfect o Simuleniously en amurrently then Wwe say obsect/ vanioble iz 2 not thread safes Because, there 18 @ chonte of data aru O o pon in thar situation. c + To make He obove sold vaniable /objecr a3 Hread safe vse synchroniiakion Concepts. #Instanc yaniobles of cur Servier Program ane not thread sofe by default whereas te (locol vawables declared in the servicer, wethod of servick Progran one thread safe by default woser window (tI) web server Te Stapp web coplicakion Ker wrocer windowl eo) Browser windoces) ececscoeoceccoce pe@ng0coe’ooDn29905 e0000 -cc Coeo0coqco0gc. ecococaccec public class estSey exteodd HS 5 for ai Public void serviceC -1-) throws Sé ,T06 3 or be =e Jer, t2,68 One thraadl2 vepresenkog a : eomests + te above diagram the mutitple thread’ representing muttiple request of servlet program will act on Single Gopy af insronce variable “a” and every thread gets ifs own Copy of boca! variable, %’ 2, we “an say Varioble “a” ix pot thread safe ond vantable Bilis fread safe- * By defoult our servier class objecr and itB foStane voniobles ane cot thread safe- TO make them 28 thread safe, USe synchro- piZ.arton Concept ‘KD Store results. inputs of servilerB program io a perminant place pe database software e) to gaiher input values of senler progrom from perminant storage unit we need 10 make servlet program Inler ackog With dorobase software where by placing JPBC ade servlets progrom # Every TPBe Code Contains three important operations. Q) creake JDBC Gnnecon object (@ use gOBC Gonecion object io Creale offer TPBC objects and jo develop persistance logic (S dose 3PBC Connection object There ane three approaches fo place spec code fo our server Pr09 ror EPpcoach (1) @) create jdbe Conneckicn objec’ In Fatt (> ey use jdbc Gonnection cbject and other object fn senvicec-/-) /dboxeala, mettods -© dose jdbc Germection objet and other objet fo oleshay( roetbod FID approadh() the. JDBC Connection object must be decared as Instance, votiable So it 18 cot thread safe Cit is disadvantage) Programmer must use Synchronization concepl® fo make fre Conneckoo object a8 thread sofe- In approach) all PRE reqvesiZ given fo sevler program will vse Siegle JDBC Connection fo fnkracr wilh database sofware THIS 1S fopeove the performance - (ir iz adventage) APPrEaCh ea)! ©) Creale TDRC Gonnectton objecr In Service Gr) /doxxxt--) methods © Use JBC conection object and olher objens In service(-)/ doxex C-1-) metrods © close Ipac cnneckion cect and olber objecrz io service ©1/ destroy () melhod! Here =TDBC GNnMecHOD object 14 loca) vanichle fo serwice C-1-) reethod So tk ia thread Safe objer Cit iS advenrage) Gach request given to Servier program will establish one 90 Conn— eckon with database softwane. ThIZ KiliZ the Performance (Er iB disadvantage) APpeoach B) @) Ger JDBC Connection object from Server managed IDB. Connecti? pool neteg from Service ¢., > method / do %ex(..-) method bluse Jose Gnnectiom cojecr and other Jpac objects in serviceC/ do Xx (--) methods © Reom TEs Conneckion objeck bock fo JDBC connection pool from seevice (-) /doxxx (-) methods Hee Commecron abject is [col variable of secviee (1) method so iF At& as jhread sate epjects CE iS advantase) # BY Using Minimum no of JDBC GMnedion ebjers of GnnecHon Pool we con make more servlet programs and oll requests Coming fo eooecoccooescoco@eeeeooooNSoKNoeseO BOOTS BIOS NDOINSSOle bees ie en) 8 2 ie 2) 2 8 ee | oe ao servler Programz fokerackng with database sofkeane- This gives better performonce (@F jg also advantage)- 4 epproach @) ig the best for servier io database sofiwar Gmmu- nicakon + Example application on Servier to dakabase software Gmmunicakton Browser Window ___ web opt hire! (static peg) Pynamic webpage BE Su ermp (elt Fable) Deployment shudure when DaSsrv Program uses type! TOBC DBP > WEG- TNF ae ovat eee nay 5 1 eb 27) oe Desry. class then DBS Program uses tyre 4 (oracle thin) Jdbc driver oBere WEB-TnF ——+ classes input+ htra| > fib J+ ba sev: joua te ? DBsev + do. ss coe au) TealS when Stand-alone JoXa application sez 39 pay API (sther than o Tok pra) then the third panty APL reloed Jan files rust be placed fp doss palhe to make Save Gompiler and IRE fo rewmgnie and use Thied party OPL- #2F java web application uses ‘third portly ORL in tre wergewer resource programs (like Servlet, 3sP Programs) then third panty APT 290994535 relared gar file Should be added fo class path and Should ako be added to folder of wos application Here fan files added a Jo hss pai wil be used by Jauae 19 recognise third panty PPE during 0 the compilation of servlet prograro- Similonly Jor files added to wo-IF \ie folder wlll Ge Used wy servler Container to remgnize ond vse Hrted Panty OPE during the exetulion of Servier progran- @000csc Ex: TF servlet program uses orade thin driver then keep ajdbcit: Jor file to 028s path and wee-1F\ lib folder of web applicarion os shown o above #the jor files added fo cleSs-parh ane rot visible fo IP& Sofr— wanes ord fa container softwares of serverd Stand alone joneu application will be Gompiled and executed From Goremand prompt: whereas servier Pregrarn Compileken tees place fo Servier @oraner of s@evier server/Application Server. # TF above eb applicakon if vealed fo Toe software then the thied pony PPL relaled jor file must be placed to fhe libranies folder of the project: Source ede ef above diagrarn based application Fopuk. biel Shore ackon “dur!” methods "9et"> Eerployee oO! S1 Foe ety eeceeqgeooooe 7700CO88000005°oO 29099099 ecooooceo ececcoceccuy - DESev + 50u, C49 fnkroct with PB sho using sypey drver onc _ogproach U)) frporr Jjauor Servier *; ferporr Jouax: Servier. DEEP: Ht Tmport Jaua- io: *F fenport jouors sal #7 Public class DBsry exberds uetpServler t Connection Gensou; Preparedstatement ps=oull; public void fork Sey © pereole, jdbo cannecnon object Class- frome Coracle jdbc: deiver Oracle Driver”); cons peivermanager. gerGonection (idee! oracle: thin !@ kealhost : 52h. satya”, “scott”, “Hager”; PS= Com PrepaneStalement ('selecr ename, job, sol frorn rap a where, erpno= 2"); Cakth (excephion e) + priok Stock Trace (97 2 S$ ytothO public wid doGer CHEEPSevierRequest rea, HEP SemmetResponse 9s) throws 3 ud Fy eead form dato, jor cos Anseger. ponse Tor (req getPanamerer (1200); ServishExcepiion, Toe xccaphton ori usiness foaic [sar ponamenr valves fo Se Wwery pe: sek Int (1,90); Jexecule the query Resulbset vs= ps: cxeategqueyd OO; process rhe cesulkSer object Sting name * null, desg= nut, bsa=oult;iF Crs -nexror) name = rs-gerString (1); lesge PS: gerString (2); wsal = 5+ 9eF Shing C3); u Wdispby emp detatla ag web page Goer Prinrwetier ese Content ype Cirext/ biel"); pws res: gerariter(: fw: Printle ("Emp derail: "); Pw-Priotin ( Emp Name: “+nare)! o-protle (Ceory Erp salary: *4 bo); popiotio Cry Grp desz t+ dess); dose Stearn objects Po dosel)? © s+ deseor Jr 45 carch (xe phon ¢) epee Sack race (95 3 SP docet (12 Puloliic doGer (req, res); 3 relopostl-» -) Publtc void destroy) 4 _ iF CPS) zoull) Ps-close catch Cexcepiion e) ‘ jo PriarStods tase) ; wu fF Coleman) Con clo sec); ? Catch (Exception ¢) ® <: print shade Facets xy 3 30 dass void doPost (Http ServierReqesr rer, Http Seruler Response TES) throws Servletéxce pHon, FOEse prion. Web 210] Configure PBScV servlet program OH “/ébuel” a2 rl poltern Request URL jo Jesk applicohon hep ‘Zlocalhost ; 2020/D8eRp/ nput-btn| tCeacoescoeocecceoepoesooooes"ose0000. RIF multiple web applicakons of @ server ane untkBing same third panty PPE (like erace thin driven then fnsteat of keeping the 3° pony 9Pz 0 celaed Gan File (Ike ofdbclJON) fo WEB-TWF) lib folder of every applicakon 5 fr iB R&mmented 10 place only once fo Gonmon librory folder of Server ° sofkaare foshankalion 6 cmmen library folder fo Temear 60 8 \Gommnen\ lib Felder Oo \server\ lib foleler © Genmon lie2ey fader fo _wieblagic (any Version? oy eee er BEA home> \wl seever— \eppServer\ lib folder AWhen wer reSource program of Wee application uses the ‘third pany OPE cass 00 inerface then the Servier Container looks for third pony ° 7 oO OPE dass of interface in the following places ond fn the following order O > Th wee-me\ classes folder Self CF not avorlable then (iN) ° DO ath the Jon files axided to weB-TF\ lib folder CF not available srertin) 3 ®) dn the gan files added to Gommoen libra folder of underlaying’ ° server. Clie Tomeot—heme \Iile folder) if here also not Gmming then ° class not found exception iZ occured) 9 Bevery server folernally Uses one Idk SOfkoare so then servict program : Seg TYPE-! JdbG driver to fekract with databsse Sofnoane ther there. wv Pe i= co c0ed of adding ary Jan fileB fo woe-T0F\\ite foldew ond o dass palh ala a wh is i = 5 ot is the difference beroeen sevietGntext cher ard Senleranf J eeaSect? v 2 @ ServerGohg check Cov): SER Is ene re our Servier prograrn (asp progrom o nueo * ServlerGnfig object means % iS the object of servlet Gofainer 9 supplied fou dass Cmplendertta?) fmplemenking Javan: servlet. Sele OF Gook3 Interface 5 KTHS objec ts Useful fo pass additonal data to Sevier S and to read addikonol details from Servier- 7 K This object 72 Usefil fo read Sever oir pamametr Values fom O webu fle ef the web application. S K Servier Gorainer creaez the serviekanfig object to the fnstankakon e and folkialiZakon process of our servlet dass object- ° K ServleF dookainer deskoys our Servier class objecr In pe destnction @ profess of our Servier objecr. Web server 2a\ (wee application) wor (wer application) 1093 (web application) 28e Q @/|©® @® C9- Servier Gofg object tng fle— mage file = sile- JavaSerpt cade Srv GYM Servleh program Ceooceeceeoceccoooeeocentoofogoea) 9 oO oO oO a oO oO oe 0 eCeceeccec ec Servler @olextr object * TF ig ene per web application. So ft iz called a8 the globo memory of web application + sewler Gnlext obyecr means fr je ihe object of a java class (Container supplier) feplementing Javax-servler. Servier@ntext interface. % Servier Gntasner creales jeig object either during deployment of the web pplication or during secyer stank Up: + Servier Gotainer deStroy® this objed autornakcally when web applicahor i® Ln deployed o- reloaded or stopped or when server is stopped /re — stanied + + using thie object we can read glo) init panamelerS o- Gnte parameters from the web-em! file of fhe Web opplicalten . 4USING «Fhe dojecr we can Enow te details of vnderlaying server like server name, Version and te serviet—api version supported by the server USING Hig object We can ger Conjfext path of jhe current web agplicakon and absoluie path of The ony web resource program fn web application. athe dara kept “& 70 serviet@oleur objet ig visible and accessible foo servier. ISP programs of Web opplicaron fin ene _web server 10 web applications me dephyed In that Sia web application® ane here fo running mode. and four web opplicatons ane fere io stopped mode: Con you Jeu me how many Servler@oleut objects are cerrently available to thar «eb anplicwem? server? @ six There 38 a web applicator with io Servier programe In thar three. Servier Programs axe already requesied by clients and other 3 servlet Programs axe enabled with load -on- stantup: can you tet! me how many servierConfig object? one cwrrently quailable fo thot web opplicatton? @ 34366 1U4NOTE: Servier Container creakZ Servlet Godig obfecr for Servier Progrom only when He dass of Servier Program 1g foStantialed Cobjectk creakion). wor servlet dass object, request object, response object, ServietGnfiy ebjetr, ServierGolexr object can not be crealed by Progromrnem manually the Servier Gontoiner creales all ffese objects bur Programmer con get access fo these objecté in Servier Pregrare #70 ger acess to OF Servier Class object Use “IhIS keyword #T get acess fo request, response objerS use parameter? of Servicet) doe (7 # To ger akess to CervietGonfig obj epprosen ) ¢ public class “TestSv extends HS/as Servlet Config cg fair Public void service ServierGonkg eg) 9 His cg2c3) Mose cg here 5 Public void service C-1-) /dlo xen cass TestSev extends 19/45 Public void inlh C > SecvlerGonfrg Cg getSecyletGonfrg 09: eee ee ee Lpubtic meirod of predeficed gencric Saevler 3 clase public void service C9) domes (27) rererh : SenvlerGoh) <9 = getSenvjetCooh9 0; nd eeoceocceoeecoaseoeoo oo OCNOsoN ee ae 29C2OD90099009cppreach@) Je Sood self class methods ond super class be called im the Subclass with oF object: public, profecket method? can RE $e ger acess fo ServierGniexr object approach (l) : Public class TestSrv exiende Hs/as ‘ Public void torr > & ServietGnf9 gs gerServier@ofr9 (9 + ServlerGniewt sc =Cg- get Servletcontext(; ——E EO OOO ; Vuse se here [Srrerhed belongs eo Sevieraofig ? publee void servicet-.-D /dloxne zg Seevler ONG eg gerServier ORY (); Sevier@olext sc « cg-gerServietGontext ©; Yuse $c here & 3 opProach@) + Public dass TestSev eulenole HS/as 3 Public void fofkor y ServietGonleur 5c= ger Servier @olexr 0); yuse sc here Lo puelte method of predefined Genarve Senvlerclast - public Void Seevice (-1-) [deer (-1-) + Sevleraorerr SCs geSevierGniextt) ; Huse se here 4 a + oF indi rectly or indirectly we need wervier@nfig object to ger acess fo ServierGonterr object NEE! PPrrOGEHO? LE Good ‘aege gerServierGonesr ©) wethod elefinikoo of predefined Grenericservier foreally uses Servier @oFig object jo give Servier Gotta chiect- class 3 o 70 moke 3PBC Gde of servier progrom of Flexible code fo ° radify th 1B retewmarled 12 Sather the following Aur clebaile ° of Joke cole from ouktide dhe Servier Progrom. They ant ia co Ipbe driver dass name 2 WITORe URL c @) pe Username ° DB password 6 0 there ame foo Ways fo Pass foput Values fo Servier Program from o outside the servlet Program: ° 0) request parameters / form dato a ~rend Ser /yisitor of web applicakon sende Frese values through Cc ° browser window Cfreen client Side) —F since end user iB nen- technical person this data will be 9a - technical data, like name, age, address of end User a servlet progean uses request object fo read request paxomekr vobes: Q) Secvler fait panomeers 7 programmer passes iz dale fo servier Program from urban! (server side) —> since programmer i8 fechnfcal person, Hig dara can be technical data like jdbe oriver, UR and ete details —>sevler program uses serviekGofig object to read! fait poramekr values of web! To make tte JOBE code of Servier Program ag flexible Gde to modify ir iB redommonded fo galher the chove Soid DEC derall® (driver cass. URL, Usemrame, POSSWord) From web.xml file ag Servier wit panameee values + Inte pomemerers one spetdic te each servlet pregiiers qav hes! fre jeormmes choke sed °o ° ° o o ° ° ¢ ° ° ce e © © ° ° e ° ° ° e a uv °eccececoce cy efor ceiced pecrp applzoiten thar uses serviet foir panameien to make refer agpkcakon 4) of the page [0% 65-65 jdec q@de of pBsw Servier aa flexible ade do mdify 4% Sed fechnical foput values fo Sevier Frogram from urb-rnl file az talk porameer values: Send non-technical input values fo server Program aA request poramerr values / form dara- piffecenr ways of ceasing Servier 7F Panameter valves SeevlerGonfrg cg = getSenvlerGnfrgt > Spares cb uy String Sl= €9- geh Inf ponameter Cdriver’); here we musk now init parameter name to get jhe value. opproash 6) Enumeration @e cg. geFTni't Posametername SC); chile (&- haBMore Elements (>) 4 String nome, = (String) e- next Element (5 String Vol = cg. gerLovt Panameler Crome) | 3 @gvez oll fot parameter names ond values - RUhen you Configure multiple init posamele® io web-uml file bowing some logical rame then jhe St value Us!) be effeced as thar Init podaretee valve. + Sing ServierGnfig abject we con gather the Gontainer crealed object name of our Servier class S:o°p (“current servier logical names instance name" 4cg-ger Serv lehomer + gives Gerviet-name> tag value from web: er) * TF muniele servier/ asp progoms of wer application ane looking 40 ese Same Inir parameters then instead of placns pom In every Servlet Configuration fr i recommended to unite “Snly once in uxbaml 8 Golext Panamekr& Gr) global mit parameerss and Use serviesGnker a> chjecr fo oll servier/TSP programs fo read these coolext parameser values, > | i. ....... ,.,,,; with pa software by using some TOBE driver to make thecr IDBE 4 Gde of flexible code fosicad of specibying 7PRC driver detocie a oS [oir paramekr2 ih every servier program Gofigurakon ir je recorom. a ended to place 3D8C driver detailZ only once. fH web-mml aB conker Porametré @2 shown below 2n_webxm) of DAP web application delver SPonore- value? erade- jdbc: driver. rade Drivers jpoxam-value> a 6 a a ° a ° a o 7 Bo S/aontete - poxarn> : / 8 dour! oO ¥ jdbc: orade: thin: locas rest +152): ord c es 5 & © 3 ° j 2 ° 5 Figen S/pevr % <1o-pr csevier? PBSev Servier -cla.ss> senile name? db url patteen> burl / uel parte eceoeccoececca200.010 9.9 3 : eee & servler-name> FestSry SS-07 E /esturl ¢/u-p> Js-m> In totk() method of pBSry Sener Program belonging fo Deep webapplication public void toftc) y try t read fotr patam values from web-.«rol Servlet Gonlext sez get ServlebGn text>; String SI= SC-gebinit Panameter C* deiver"); ~~» Gonicxt Panamelte name String S2= sc-gerInit PanameterC “dbur!"); String $8+ Sc getTnit Panameter (* douser*); Sting sy+ Sc. gebInitPomameler (*dbpwo")! 4 Usame a2 Prewious opplication code. init ponameter® one specific 40 thar serlet/asp Program for whitch they ane Goofigured- Gnext pomamelers ome visible tm all web resource programs Ciava based) of Web applicaton pif ferent way8 of reading conjet posameltr values Servier — Se= gerServier @otexk 9: anrecach (1) Siring Sie sc. ger Seevlok Toit PanamererC*deiver): here we musk kau context parameter name to get ire Value Weapproach @) Grumerahon ©= SC: getInitParametr Names; while Ce-hag More ElementZ0) t String nome= (String)e- nexrElemenk O : Sting val = Sc. getInit Panometer (name); i HER ON Comfexr parameter Homes and valvez- we can Use some name! beth fait panamerer af Serviel grogram and for Conteer parameler. we can acess both Hege Patameter values fo our sevier program using servlet Gnsig, ServierGolext objets respectively: TO gather misc fofo about underlaying server vse servlet Gonkxt 099009960999900999290 object af show below: o ZF acthecing mise jofo using Sevlet@nlest obi Po-PrintIn( “server info 1) ¥sc- jet SeverInfo 0); gives Apache Tereak 6o. Peprintlo(“servier opf spec version impl by underlayiog servers” + SC* getMojorVersion (74"-* + Se-genmincavversionv) owes 2-5 — Perpriotle (*conterer pol of current web application :* + se-9¢tGantexsPatht)); ves /o8Ae? perpriotio Capsoluie path of inputhtol on server :"+ sc. serReal Palh ( * Viog uk bh”) Gives Tomear insiesiarion PIR and “rpubniml * Tomcat 6% —> given based on senler api 2-4 spec + Tomcat 6% —> given based On Sevlet api a-s spec + Tomeot 7:% —> given based OD sewler api 30 spec Whar 18 the diffrence bekoeen cade placed i jhe consivuctor andl Ge placed tn the fofk © meitod of our Servier program? nce Servier contac TreMCR —iulctganfig ebyeci AFI exe Consivutor ececoeecoecenree00000000 extcuion ond before g¥eaun init) method exeeuhon in the. fnstanhalion ©o ° Oo oO oO oO oO oO oO oO a ee wae eece and faikalitaken process of servlet program 30 SenilerGnfig object jz pot visible f Gonshuder bur vistole and atessable in the fio method Since servietGokecr ebfecr con not be accessed withovk Senleranfig object so the ServiekGotext vojer jg not accessable jf the Gonstrudor but SenlerGotext object iz accessable fo the foitt) method the code placed in te donstructor of Servier progrars can nok Work with folk ponamelesé and Conkeur Poiamelers ushere as Ihe Cade Placed fo fnik 0) method can oft lBe Hese ponamerrs so Tr is always Fecommanded fo place pe fnitialiZaien logic only fo toiti> method. Tdbe Gon object a j Direct Idbe an obj 2 Pooled Tdbe con obj To geal direct db wo ob) dass -forNome( “oracle. jdb¢- driver-OracleDriver*); Connech’on cons Driver manager. getGnnzcton( url, uname , Pusd )) tthe Tdve donnectton object thar 1B created by progrommer manually 1B called as direct Jdoc Gnneckon object # the Fdec comneckon objet that cotiected From Tolbe Connection poo? 1 called a2 fooled gdbc conneckion object. B dypes af Tdbc Gon pools © Deiter managed gelec con fool @) third pony so monaged Tee Gnnection pool (like Apache DCP. ¢3P0, proxo8! ard etc) Gy server managed TJdbe Gneckon pool C1 web server. application server environment) # Oracle Bin driver gives ome built-in dee Connection peol in HB Qidtc Jan file. thar Grmecion pool ig called a2 Deipermanages Connection tuys2 pool: use~ (1),@) type TdbC Gonnectivn poolB fa stand alone applicatiens Use ( type dooneckon pool fn those applicotons that ane deployable. fo the Server like web apylicakong, EJB Components ond etc 3 in Drivermanaged, third porty sto managed Jobt Connection pool eoviran. 9 ment we need to 088 fypel/ typer) types jdbc driver? G 4 tn server managed Idec Connection Pool environment we need to ose 9 fypeS with typel/ typea} lypey Jd& drivecg. 9 4 Gach Idec Bata source object represenk® one Tdke Gnnection pol 9 to ger each Gnnection object from connedien pool we eed fo depend a uPEO thle dato, Souree object. : 4 JdbC Doraseurce objecr means ir ik the olject of o jaue dass 9 thar fenplement® joven: sel Dato.Soucce interface - . #Oll Idee connection objects ef cenneckion pool represente connectivity O Wik same darohase sofhare: 1dbe Coonecrton pol fer oracle means all Jdec Conneckion objecr3 fo jhar Genech'on pool represents Gonneckivily with orade database 1p rea'shry > weblogic registry regisiey based colled 02 look-up operation sub Packages: one built-fo cegisry s/w websphere ——? cos registry # The Cemecton objeck of end database Programming ceplicorion and registry softwane+ cpa applicakion objec of dadi Uoder standing the sever managed Ciawe agp 69 servier Pra / » ger DatoSource: obi cat fron registry ci calls gerCoonedon cy 29 pakaSource, obj ref geta one jdbe Ge obj From 5de¢ con pool three. 3h porasource obj 1B) eorite jdbc persistant logic based eae on 4 Sobe obj en 8) release Gn ob} wae 4 5dBC Go pool ‘software represents Jolec applicakon represents Gooneckvily bekveen, Similanty fhe tathial Genicom Goneckvity between Jota Idee Geenectton pod! environment APP Server [web Server jdbc con pool for radIn server managed Jdbc Gnneckon pook environment 19723 with tyeey joe drivers will be vkised+ Here typey will be Unuized a8 a a driver to fateracr with datobase sofkoone and to ceale Connechvo . objects tn the Gonetton pool where a2 type 3 will be used af a @ profoc| by client fo ger Ore jdbc Gonneckion object from sdoc. Q @orecton fool a with respect to diagram 0) TL or PL wakes applicatton server to jnferacr with DB sho Usieg Q ype! or lyper or typey rivers and creales jdbc connection pool having © fdbe Grnedtion objects ‘ @.G)7 TL PL creales datasource object representing the above Jdec Genneckon pool and also keeps har dato Source. ckfecktio regishy eo sofkoane having niclename for globod visibility. . (4) —> clienk opplicakoo gets parasource objecr reference from registry c software through look-up aperakon G 6), (6).G) —> Clienr opplicakion calls getGnneckion Ly en dparaSaxce object $ reference this coll uses type protetes io get one JIdic Gnneckon a bject fom Gnnection pool: . ®) + reer diagrom ° 8) > refer diagram 2 NOTE: the released Connection abject fo Jdbe comeckon pol becomes 9 peody wo gle Service fo nexr ewes or next cient. 4H pee eee eo Gees | fe 9 fo GlassFish 2-« Server 3 o Shep9) plage aideery: Jor File fay cgup_bamel Y AEpser¥or} denn 73 Nemain\@ EX eats folder : VERGO: place mysel retail Ganector 5 jdbe driver’ jan File. Corysal = cen Ader - 59YR- 3-018 ~ Stable -btn- jon file) io Glast Fh he: 4 \ clones \domacn!\ hh Vext folder ecseooca 4 © sfep@! sramr GlassFish server ane open THE admin Console (domain) Server’ OD sep@: create Jobe cnnecvon pool for my Al Y 2 a Adiin console —7 resources —7 Jobe —> @oneclion pools —r eead—r oO 9 owe : frp pes | o in Resource type: \Javax. Sql. Boro Source VY) Darabase vendor : [ep al] : [esa] } —tnewt —> iniKol ond minimum pool size: [BE] Goitral cope o a mow pool side! [a] c 9 oe o idle Hime out : ° oO @ Database came - [sbi c TA password = [root] oO Port; [3306 © 0° Pork purmber : 5 Wl servernome « [esslroae} . TA VAL 1% Selo: ry sai 8/ locothast ; 3306 Jab! oO url t jdtectmysal | /loco) host: 3306/d41 ° (Quse ! reor 9 —H? Finish —p Lownch mypooh Ccltck 09 mypeol!) —7 Prog cHpQn: creale Jobe Dalasource representing the above jdec cnncekon oe D pool 2 uv Admin Console —> resources —7 JUbe —¥ Idec resources —y aa —> a 5 INDI name: (ary nome) Cit beGomes Nickname |r alias name z orce pabaseurce ehfect 15 registered Wir o Pool name : |mypeol } _ v V9 aK v 19Dwie wil! once 0 wHOD iB clicked the above creaktd DotaSource object be registered With registy software of GlassFish Server aulomak- cally with Np) came DsIodi Eoxexarpie web application where servlet program uses the conneuion object of jdbc GonecHon peal fo inferact With DB Sho Browser window bynamic webpage FAA (D8 tele os him) fable) eo| fodex + hin Glass Fish Sener (8 Gon SF From JC cn goo) ) E: \ pepe [+> real pp | + wes-ior I fodex: bin eee ee 2b reer} [eee > cennpoolsecvlet + class * Poepaming war file. ai # deploy \Peps\pool app Sfoa cf Pool App - wan the above wan File in GlassAsh 2. server SBUQSSEISh— hame>\ app server) domain? | domain t 92 CoCSCTOOCOSCE OL DCO CRQDD EOS OOSC OOO OOS OOESGe200099055° oO o oO 2 oO oO v Request URL to fesk the applicahton (heee:/ localhost: 515//poclapp/ foclex « hin * For ebove diagram based example applicatcon refer applicahton 5 of the page nog 65-63- * Bloay? devebp web epplicahoos by teeEPing nos ~tennicl mip end set fo mied for tat awben caceptien ip raised in web reSource Programs instead of disploxing the exception celated teormied! messages braser window fr 18 re@mmanded 1 display those messages as non fechnical guiding message? for enduser. For this we reed 0 core Some Presertalten loyic fn the catch blocks of Sevler Programs #Indi api ig parr ef jova se module so we need not fo add ary jon Filet to classpath while work wit Jodi opi Procedure fo “reakt 70RC Connection pool for oracle Dako Source fn oracleweblegic 103 SHPO); srant Adv javasatchPemain Server of weblogic and open th8 admin console Stank - programs —r oracle weblogic —> USer- Project? —> Ady. javaBatch Domain — stort Admin server for weblogic server domain wep? oper browser winded the following oRL heeP! localhost; 409! /@msola Services —F JDBC —> pakascurces mew —> Name: myds! Clogicad name) INDE Nome ; DSTodt — (Required for client while perforning lakuP operakon) parabase types orade patabose driver: “orocle’s Driver Cihin) for service connections” —? next eet Database name: satya Host name: becalhostpork no% 1521 Database username : scott Dorabase password: ger Conform password + Hger rest Gnfiguration —y next —7 selec admin server —p Fralsh NOTE! when finish bulton jz licked the loka source object iAat represenbs pee Gennedtion pool for oracle will be registred with regishy sofmore wilh Sed? name “pind” SEP)? speafy the TPBC Ganection Pool additonel properlies Admin console —% services —7 JDBC —+ Data sources —zmyd5) —» Conneciion pool tab —F Inika) copacily (J maaimum copoccty [5] capacity trccement rspecifres the ro: of oa JOBE GinnecKor objects Hat should be created at a Kme ff there ne ee ee eters fo 4h Genection peo! > save —y Advanced —F shrink frequency + [joo] Seconds —r[EaVE) ‘efor ORWZing the above server monoged Connection pool we can run the appiicahen @® oF the sookler. for thar SPO? make SUE that the Adv: javaBatehDomain server ig fo eunning mode SPH? make sure that DSInd? is specfied ag the argument value of fe-lookupé-) method fn fice 90 SIZ SHPO Propane dhe deployment dlicectory sirvture or wan file representing dhe wets application pool APP ee INF > dasses oclewthienl Gorn PodlSenvieh Java, wxbamt [; [-—> Gon poolsevier class SEPTY)< Depoy the ebove Poolorp application to Adv: javaBakchDemain Server of webjegic caps the Pocloop folder to weblogic-homne\ widvlewane\ User. Projects \Domans\, Blu: JavaBokch Dornasn \ Auto Deploy folder. I9OODB9N5 eescscsoant coos ecooooeocae ef ececcoeocececstepw)i Test the application peips // localhost :700' /Peolenp Jindex+ btm! boss server boss server “yee i application Server softowe version: 5°% Campotable with Jdk 1-6) vendor t Apache /Red Hak opensource Sofkoane pefaulr port aac S080 news to creak domaing and also ges 5 builtin domaing: they an a) default @) web (© standond oat (Sy mintenal te download softoare: daunkad slo as zip file from wow.opache-org website .srallation process 4 Emtradk Toss -5-1-0-'GA- JKE. BP File to Oo Folder. + gon file thar represente all Jee APE? jkOSS~ javace- jon (Jkoss-roreg\ rent) Procedure 10 change the port mo: of Yefaulr’ domain server of boss 5% Geo to TbOSS Home server \default \ deploy \ jp0S5 web jan\ server aml File” and modify He post atbibule of fiest bag TO srostt jboss server (“default clomain) use jbossneme \oto \run+bakeh File #1q Tbhoss server there, 12 90 console deployment. Buk hard cteplaymert 42 onoilable (only won file based hand oleployment is supporied): Notes Tooss, GlassFish Server directory based ford deployment . They only support -war file based hard deployment. reProcedure to deploy Jawa, webapplicotiod tn default’ demain of boss server skpOt creak .won file on the deployment directory Studer of web application: £1 \peps ee wooo = WEB-TNFE ~~ i: detodla-bko! 7 ~ to prepare wm File €:\ opps \HeSlAre > jor cf Hemline wan SHPO) stant default” eormain Server of TboOss SEPGI Deploy the we application fm ghoss secver copy the above ~Litminep.wan* file fo 3b0ss-home\serveridefauit\ deploy Folder. skpUD: Test the web application open the browser window and Wype ofthis orl trp: flocalhoSt : S151 / html app/ deraila- him! Gmnmen library folders the common Iibaary folder of default’ domain of Tboss i8: Tboss-home\ Server defowlk\ Lib folder Procedure 40 Grfigure boss With mysdipse TOE taterclow menu —¥ pre ference 3 > my Eclipse ——y servers —7 hess 9°% ——> Enable Tbess_home diceuory: gerver nome (domain name) — apply —pors oencececoos ececrceceece:Ox) oO oO oO oO o servlets on from oa browser window and Processing fab repost & chain jg called af servlet chatoing In servlet chaining we perform communicaken between servikt profrans to process the request given by a dltenk lek chaining Taking requesh by sing roultiple a * All servier programs request and response 7B given by dlienr 10 perfor Servlet chaining Dispatcher objecr means dass implementing Fre oe aypication Servier chaining based Webopplicafion thar panticxpale fo a object because tr iB te objet of o Sevier chacoing will Use seme ‘hey process fhe same reqesr thar we need ReqestDisparcher object Rewest— @nrainer supplied Javar favex: Servier. Request Dispatcher inker face Servier chaining a —Lr—r—S—esSs |p Forwarding Request mode of servler chaining The biel ep ef sry ail ke dli-seonded ane! the oni bil oyp of sev pro sees to brveoser tide as responce” Sew) (source. Servier) 2-twcluding Response mode of Servier chaiaing- se. seeviet) SCV! bro! ofp ‘wit! rot be discon He bel dp of beth srvl, Srvb loge FOES fo brouser Windows as r# Spence, pesIn any mode of server Chatning ys programs will use same reqest and response’ objeuz- TF seus, servi, srv3, Srvy Servlet ProgramZ axe there in forwarding request mode of > server chaining then the Heal Op of Sev, sey2, Sva Programs will Le discarded ond only fhe ofp of sruy Servier program goes to browser window : AIF srvt, Sev2.8V3, Sey Servier programs axe there fo focluding responce mode of Servier chaning then tte bho! ofp of all servlet programe fo. * gether gee fo browser window as responce * The Source servier Program use.£ ReqwesrDisparcher Object jo perform Servier choining wilh destnanon ub resource program (like Servier Program, {; JSP pregrom hho! program and e&C---) oO o There one 3 approaches to “real ReqwestDispatcher object ty source 6) Servier program poinlieg to destination webre Source program : Keproachd) (ey using rey obj) BE an sevi source cove a rentonal 2 Re qwestoisparcher ed = ceq- GerRequesrD1 sparcher (Jszur I"); G ed forwand (rey, res); Lan patter of destinakion a Sever program (seve) & o d+ include (rev, res); C c £xQ). an source Sevi Program o RequestDisparcher cd = req- gerRequest Dispatcher ("/abc: bhn!") | : @ i RequestDisparcher cds eq: schRequest Dispatcher (- /abe asp)! : cds forward (rev,res); c 6°) o fds include Crea, @S)> 6 o Aprreaach @) (ky using servieronlext obj) 8 EX)" In Sovree servi program & Steyler Conkeet Se = gerservierGotexr emerson bo ReqpesDisparcher ed = Sc: getRequesrpicparcher (* F2urt"); - d+ forward (6%, eS) Tome paren of dest sw [ ec Presnam Csr)ds foctuder reyrres); XA): Tn source SrvI Progran ServietContext Sc = gerSerylerG@olexkt >; [Prmardates Request Disparcher rds Sc- get Request Dispatcher (Jabe -birnl); on Reqvestpispakcher rd = sc. getRequest Dispotcher (*/abc- jsp); te for wand (req res): — eds inciyde reqs res); Approach ©) (by using servierGoniext obj ) 6x0), 29 sre sry) Progr Servier@nlexr se = gerServierGniext ©)7 RequestDisparcher rd = sc- getNamed Dispatcher (” sa"); | Ty logical name of dlestinati~ ed: Krword (regres); Servlet @rogeary (like 2ru2) or) Biven in were! Kile ed includes Creve); EL@)i an sre sit Progra Reqwest Dispatcher ed: se. gerNarnedDispatcher C52"); “+logica) mame af destination rds forwoand (a, res); TSP Program like abe J5p 6 ed clude Creq, res); MoTE (0) af seurce Servier program calls rd forward Creq.ces) method then COCHHCHOHOCAOSOCSOSOOCNOIOOIIO HOS SFIIIIIIVI DOD ik performs forwarding request mode af secvler chaining with destination toets resource program. NoTG @\i In sSowce servier Program calla rd-incudetrey, res) method ten iF performs including response mode of servier Chaining with destination web resource Program eservier Genfiguration fy web) ig mondalory so tt name and URE pattern. TSP Program Gonfigumeton fn usb! file is opKonal se it may o Contains legical ecoceecccece may cot orkein legical mame and URL patlern. We can aot Configure hel |7 . te. program to webraml file thar ie the difference between gerRequestDispatther ( ) and ger. Be Named Drsporcher(-) methods > a ee getReqwest dispatcher «) 41 Nomed Dispatcher (7 tovokable en both rEquesh, servletonkext 4) anvekaile only on Senvlercanient- objects. object desrinakon Ql Expects URL patton of <'Servier progrom — &)Expech# fegical name of the or file names ef destoakon xSP or Gesknakon servlet /asp program pho program a angument value o2 angument valve ©) THA mubed generated ReqestDispakther —@) th'S methed generaled ReqestDis- object cor point gly the desinakon Pobcher opject- con Point only the Servleh, 38° Program and hho! program destioalton servlet, asp programs whar i5 the difference between the _Recuie st Dispatcher ohfect thar is creakd based on ReqestObfer and servletGntextr object > fee One entnaecmmrt (@) the Rewest cbject based RequesrD(sparcher object expects that source, Sevier program and destination web resource Program fn a same wes applicaxon A the ServietGniext object based ReqeshDisparcher cbjecr allows to keep the source. servler program arg destination web resource program cline me some wee application a {9 90 different web applications af same server but they con not be there to hes different web applicalions ef two dif Recor serverz- ecowser, Here Srvf can use req obj or Servfeenieer obj based KeywsrDrepicher obs a 200090905 eroccooeoescesceoceeeceoconeconenD000999999900909 browser Here srt should use ServielGnlex- obj based RewestDispatcner oby web serverd, 1 fai nok possible with Request Dispakcher obj rwo servile Programs of hoo dif ferent une logic server bP-n2otiree s6p2) oa ) i 16 gless fran [00 other wise Ihe. , browser els Server 9 pTest@oe! 9 9 avi ° — 3 Se ° oO Thiz kind of servlet chaining is ° re 1170, US Send redirettion Gocepr a BF senvter chaining i£ all about performing Servier- Servier Gorm unicatton: ° 0 Performing Servier chatoing bekwean a E 0 web ofplicakiong which reside fo jhe Some server ° ° ° ° Copur- html) . Avalye: [3E—J 2 Ld v 0 9 Gy etp vaspense| v oO U NOTE: dn the otove diagram sev progam fonsords ihe request to sea. 2 oPlty when the generated sqpare value 2 sevt direetly senda resporse fo browser window displaying Sen e Vahue- °peployment direckry Shudure tapone, ER -INE ses | fopot wee-mer | —__-__—~rclasses | ——+sev2“joua, ica —— Srv2- dass Deploy both hese wevopplicakens fo web logic server (Adv- jovaBatchbonain) Copy coftone, wanton web application? fo \user-Project A) domaing\ Ady: javatarrDomain \avtodeploy folder On Sev ServieF Program of fhe above WHOne webopplicaken We Mus create Request Dispaicher peje based on rulerGniexr object spurte Code (sone) inpor nol Lior pattern of Seur Sevier program A value! < bey <(fouoy tnpork jouan’ Sealer, Iepoct jouan: Servier HELP; feport javon fo. #3 puvlic class Sev! extends HetpServier patie veld Service CHbepservletRequest, HLipServletRespanse rts) Throws servlet Exception, Lot=100) —velesplay square value on browser wirdao Peo-printle (*srvl: square yal 1% :"+res): 4 else 4 7 forword the request fo SrV2 frograr® of wero webapplication Wer Access 10 seniler Cooler obj of wPone web application SevierGotexk sciz gerServierGotext ©; Ugur Acess 10 servlet Gonkext obj of WOTwo webapplicakion SenlerGnlext sca. = SCi- gekGoleak CwaTiad ) (create Request Dispatcher obj poloking to Sry2 program of WRTWO «eb applicalion ReqpestDisparcher c= Ser -getRequest Disparcher (Y/S2ur!"); I forward the red fo Srv2 Program from Srv program rd forward (req, re5); Wase SY service 4itdass web aro! Configure SCV) Program with )siurl ag VAL pattem Source code (ATWO) Servi java, Tanpock Jawar: servlet 3; impor — jowax. server http-+; import Jawa. 10+ # Puwlic class stv extends Het pServier & Public void Service CHbtpSevietRemest rey, HetpserierResponse re) throws servlebexce phon, TOExcepHon: general setkogs Prictusriter pws PeS: gerwritera; tehres. SetGonjent Type C*feuk/htnl")) (reads form dake. fot 90> Tnteger- parseInt Crea, - gerPomiam eter (tH J) Ifiod wt cube value fok s1¢32. 2 90% 90 #99; idisploy cube valve Pw-Printls (Sua: Cube vale 58 :“eres2);, 2009903009 Bur seevice (+=) aéclass web: %rn) Configure srv2 program wilh He URL poHen {seer URL to Hest He applicaron heEP: //localhost: 4070 /upone / foput- hiro] the getGonteer C) methad of Sous ¥O when Hak rnathod Sawa. long-ullPeinperé Keepin leks In most of the servers _ genie Grier interact 6 oot teoplemensed ie calle io Hose Servers we, will ger ee) fo this cevler chasing serve 400 didferent sevvier Prog. pee ya or possible. in 1o9St of ha different wee apelications (ike Wabl@ie lS, Temoak of versions, of ihe Servers: gRoSs Versions, Glass Ash all var$90) x E lgic $x and por te ob0ve S0td chaining con be acheeed fo werlvic & oe Servers F Sine gerGnient ©) method of Sevier Goniext interface i& not implorsnied Propecly in all secverB so we can say the Request Dispatcher object wased Servlet chaning 12 good only when bolt sounce Servlet Program and destination Web -esouce Program resides in same wet application. “ia remain Yo sivalions iB recommanded Jo use send cedicedton concept 7 johor is the differerke between rd. toclude 6), edt. forward method? > Refer cespectve diagrams and key points of previous concept KT Enon the went javo version »java —yersion Fiche multiple Sak softwmes ane installed fo your @mpuer having different tonS then that Idk vs SCoooecooose ocoeeeoeocococooODOD000 vig im placed as First value ef pai enviconment vancesocc ecoco$o ecceccccecoce tote applicator _[s2ud_is the unl pone of sna py srvi(sre peg) nate comes — © hetp response. Here Sevi program Cer rg) him! o/p will eo be dliscanded. moreiver eo Seva servier program hte! outpubs tpgelher goes 10 browser window a5 response # cd-tnctude ¢-/-) method performs including response rode of Servier chaining + Boin seur and sev programe will USE same request and response: object so the request data, coming fo Sevi if visible and access— able wm srv2- TO Fass additional data bekween sev} and Srv2 Use request attributes 4 Browser Window gers response fom srul program by having the him! olp of beth Srvl and srv2 programs x srur hel fe can be. foclucted ony where in jhe. Iphol op faa by calling rd-loclude @-) method in the aquired piace. KS ord sev2 con be there in Jee Some web application &) con be there fn two different web applicakons of some server. # Sey can be a senller program, TSP Pregrom er) htm) — program AIn real Hee cde include G7 1 oseful fo include the ofp of reusable legice like header and feokr logic’ in jhe oulpur of Chm output) mein web resource programs (Sieheader logit heoder legit main -contenk logic, main -cortenh logic. fooler (0! (Generates web page!) Generases web pager) Coenerakes uaels page 3) Ol web poge® of Website generally Contain® Same header God footer conents Wr the main content wilh be changed tn every Web page pin the above diagram heoder ard footer logics ane not reusable because they ae Placed In al! fhe three Servier Programs eventhough Whey ane same for al dhe tree Sevier Progreuna Solukoo + oo - ta Solution diagram soder and — footer logicz axe seperakd fron main servler proseamg of web appiicaticn and they ame placed fn to Seperole web ressuree Programa but their hol oulpr be fncluced fa main Servier any retreat) pregrams bln) oulpuh. thig tndicates header and feckr logics axe made eS reusable logics Cceeocoeooos 3G Oeeeooo000779000090905900999990599229099090 ° eceoaoooo°o Ceocceccoc ca ¢ sample axle based on solution dlagram Headersry + jove (having jpeader logic) public dass HeoderSry extends HS public void Servicel-r-) throws senVlerexception, TOBKception ' Prinheriter - po sre s. gertoriter (97 " reS: SekCeokent Type. (Hexk/ him"); Par peintin("s a TH yA <) foot? J : Pe“printle(” "); Don place punctoset? in 3 jreaderl 12 the Headersry Servlet Program Header sry footer him! having footer logic) gi? Mace Servier pege Public dass PeeSrv 1/2/3... ln extends HS + Public yoid sevice C_,-) throws se, 705 ; Reqest Dispatcher rei ull, eda = pulls rey Minckide reader Content from Headersev ral = req: getRequestDispatcher C/headeruct”); rdi. include Ceey, res); qos 10 generake main Gnker of web page Hinde feos Content frore Footer Aho) edi = rey gerRequest Dispatcher (“/ footerurl"); dr + include req res) ; a catch Cexcephion e) 1 €: prinkStackTracet 7; a (5gFone the cd> forward ¢-,-) methoo executed fn Source Servier program 4 Ihe the effec of rds include (-1-) wetbot call ott ook be there fio thar Sevier Pregrom that means «d+ forwond (-/-) method call discaxda bolt direded ond included hn! outputs cf Source servlet Prograsn- 4 Fer example application 09 bol ciforwand(-19+ rd-inelude (-.-) method call2 refer app ©) of the page Ap 67-70 #nephs For example applicanion en el-forwdand¢) and rdrincude ¢) alse refer app (8) of material % while working With rd-fnctude (~/-) method don't Gornmir the response fo deSHaaren Web Source progr by cating Pus closet) rnefhed because th woe allow US fo add forther oulpur generated by source Servlet Pogron ond other destinakion Programs. Sub we can do His Work Sooceoesescsnnr29099599090¢2 while workeng wilh d+ forward C--) method ¥ Don't commir fhe @SPonse in source serler Program by cating purctoser method before rol: forwand C-1-) method call because this process thrans g Jova-long: Dllegalstaleexceplion Coan forwond ofier cesponse has oo eo bn Puorclose ©) commit the response of web resource program —jhabk means ft does rot allow) to odd farther content 40 response (GOD understanding ad: forward ( method http response. “The html outpur of sevp 9 1 ___________——— 22 ditscansted ant any the hel coper of gr al 9k eceoneeceererc*ceceoee sponte82 8) 688 2 ee ae 8 |e key_pofots i ree forword (-/-) method there to perform forwanding request mode of Servier Chaining- & Bo, SI ond erv2 Servier programB will Use ame request and response. ebjers #0 the request darko Coming fo Seyi Clik reqwest panamerers , heades one vistole and accessable in Srv2 program #1 pass additonal data beween servi and srv2 programs use “request” abtribviee- # All the Stakements placed fo Srv program before ard after rol-forwaw roethod will be execitt bub the entire brn! outpuh of Srv) program will be discarded + # BOM SrvI and Sry2 can be there ether fo the same webapp lication © hoo different webspplicaHions af Same seryer #ErV2 can be oO servler program ed Tsp Progra Om) bi! program # d+ forwond Gr) is very usefel 19 Confrguee Grror Servlet for offer ain servlet programs of fhe web applicakion what ix Error seryler? (@ The servlet program that execultes only When enception2 are raised io cther sevier program ip called a8 Error Servier This servlet i@ useful 40. display exception related messages ag non- techmical guiding message on browser window when excepkon8 ane raised fo other sevkt programe of web appkcation sample Gde to cenfigore Error Serviek errsry: javey Public cass ErrSv exenda S/S x public Void Service C-i-) Hrrows 86, Toe - cas: SebGatent Tyre. CHeet/ him")! Pricktoriter pas = res ger coriter 0); Pron peintin€ “< font Color = reot plalernal Problem ); (4)poo: println ( Go te Sa bref ="inpot-himl> tome "); Jur service(-/-) jrdass U “feur\” i8 the orl pattern of ErrSev program (in web-l) (mato seniler program of web application) public dass peSev extendg lS public yord fofkC> q - - Same a8 previous applicaton - 7 7 (oe cate) 3 public void doget (-.-) throw SE, ToG 3 ty 4 = some as preyviou2 opplicakon 7 Grose wee) 3 catch Cexception 9 4 try 3 Request Dispatcher rd = req: ger RequestDispatcher C“/eurl") : rds forward Crea res); i carch (Excephon €1) J el Prick StockTrace()! 3 | EEK EEOCOCOOTCTOCOKDOOHDEOONDOSOOSOHOOIDIDOEI99IIIIO DSa fuotic void doPost (---) throws sb, TOG doGer (req.res)} oO t public void destroyty QO #2n the above sample code when excepion raised In the ri doger(-1-) method of pasry Sevier Program the Error servier C&rsru) . program will be executed automatically because of fhe rd: forward C-/-) 0 —— rpethed call’ e KTP Servier pregram contains rd: forward (-/-) method call then tha 2 Servier program him! output will we discarded but their sopl'-") |. i. ges 8 Are ee ee) * Prograro with Ganditon stakement show thar Mme html — ovipur OOF tar source serviet program waft! be discarded only chan Other condition is satisfied otherwise the him! oulpot call) nok cand eck + + Dn real Hme prajects d+ forwand (---) useful fo we Gonfigured Grror servlet and to make wee applicahon® 98 more end user OU frrendly web applications. ° © pepleymenk gi oO ey rectory Shruckre of the above sample code based u ebs application a)dasses |? DB sev java. | poftbbe 14 307 [> vesey class coe’ 28) J—> errsry + java, [> ersrv- dass * Develop the above web aplication resources based on above sample Code and opplicahtoo @ of the boolclek- ine lircitakion with Request Dispatcher objet based Servlet chatoing fe tt can rok be Used When Source servler Program and destnakeo web resource program axe placed % hwo different wes applications of same. server Cvery feu) servers axe Supporking this)ier) tn boo difftrent wee applicakiong % two different Server$. to overcome thie problem use Send redirection concept of — response: Senel Redlireek <3 method ae ae Diagram u) Redieck (*/swel): srva,(dest Pra) Frnal esporse The hiesl output of Srv! (sre) Servier progrom will giscanded ond only the brent output of Sruz (lest) servlet program wil be displayed on browser window as response. J8 tke URL gruken of Seva sovler program: ° COCCHHHEOOXOSOFOOBGONCOSS3I00999090 ecoocrnecooceDiograme) webserver or pplication server Browser _wiodow el beep: 195 rl (aeqwest Url of Seva program) ve LEP: local host:2020 /wwee | seuel st ud of ror) ciagram®) Seoesser csindow 'o01/oAa} stort); IvyUsing Send redirection Concept we can not perforin response fodusion bor we can forward request from one wee servier Program to destication web resource. program: + WiK, respecr fo dhe diagrams () Browser window gives foitial request fo Srvi Servier Frograre mal she stolemenis of Servi servlet program exeauie® Indudog res: senc! Redirect (-) rmethod (@) Servi program generates implicit response $0 browser Wiedow howling Hee vet placed 00 send Redicece (-) method az argument valve: The response StaluZ Gde of this implict response 13 300-399 Cindicates re direckon) + ) Browser window Uses the URL @ming from fmplicct response Checause of 300-397 Staluf Goede) and generales fmpliwt request to sr program CAD fee stotementa of Srvr program exeaited ©) The ovlpur of Srv progron will be discanded and only fhe html output of Srvi Program goeS to browser window ag final response- Key points KR SrVI ond sria will OF VBE Some request and response obfecrs qty use different ses of req res objec. 99 the requeSi olata Gorning 10 Sev! POGram 18 oF visible and accesszle fo sev2 Program #0 send additonal dara from sry) Program = sry2 program oppend qwory SHIPG to the, URL of 25. send Redlieeh(-) method fo seul Progrom and read 'hose yolueB fn sev program a2 rewest Paramerer vasoes de sev og res: sendRedivect €"/s2ur!? pls val! @ pz = vain); feS- sendRedireck (” hkép:/loCalhoSt 12020 /onz /s2url > pre val! Epr=val2"); 6 1eS Send Pediceck Cnttp: machine 2: 300} Jar] 8011? Pie vals 4.Pr= yaa"); Ste Shing Svs 84" SerPonamerr ("91"); fog sim rey geeencurcierC' PH) 20 292390009090 ecoroceceor seo eeeoegeo0005CCCO0000* Sri ond Srv2 en be there fo the same weP application or con be Ahere fo two diffrent web applications of Same server or hwo dliffereot sever® (Hese two Servers can be there fo the some Machine oF fo two different machines) *# TF Srvi and srya resides in the game web applicakon woe con pass relative peth tm sendkedirect (-) melted offer wise we rust Pass obsoduje val ¥Srv2 can be @ Sevier prograrn or JSP program or him) Program or ASP progrars er OSP-aek Progrorm or php Program ebc.- ‘The ovement res.sendRedireck(-) method execules 7 SrvI program ite entice hil outpur of Srvi program will be dfscanded. In real time to pass tre request of one webSile 10 another website ssithout worrying about their féchology environment we can vse Send Redicection IBM has acwired rahenal-Gom go the request given fo rakonal-com wit be edivecled fo certain web resource program of fom-Com wee-ane A cla.sse2 input entra 25 pu Pe Srvi-jaya, sryi- class Deploy in Tomeot server rest npr. WES-ZNF dosses vo Sawo J xb am [fs Deploy to akvsJavasotthDomain of weblogic sever [beTestApp! Cweb application) foput: btrol A value : B value ¢ forra + html, ‘Sum iB: 50 multiply “600 weblogic server TesrpeP2 Cwebsapplicahvon 2) Servis Jaue: feporr Jovan: serviet- #7 Import jawax- serviet help: *; Fepore java fo. *; public class Srv! extends Httpserviet Public void sevice (-1-) throws SE, Toe a (general sertegs Peinktaetier PwW= Cesr gertoritere! £23" Seb Content Type (HF /hieg [*)7 Werad form date fot yall = Gateger: parse Tob (req* gerPanameler (Ly) SDUP) ? cwers SHI03>); 20999902 ecneocoeoceecoscoen@eeeeonrescoseengoonDoO oO oO oO eooc for yala = Boleger- ponse Tot Crea- gerPovameler( *#2")); W4i0d SuR0 yalue for Som = val) +volz; Pw prratle C* SeVI + sum 2 " +S); Ieedicect the request to SrV2. Pregram of Testapp2 S:o'PCSrVI: before res: sendRedirect (-)"); 185: SendRed ireck Chit sil localhos? : 300! /Testopp2 /saurl > s-o:p (Srv2: after res-sendRe direct (-)"): pucatatioaieena qwory Siving hawing dake. to Wdlose steam obj Sted daka. fo sv» Progrom pus closec?: Sy servicec-- dass ~ web en) Configure Sevi Servier program with “/siurl’ orl-patiecn Tesrppp2 scurce Gade (web applicakona of different sever) Sevy2+ Jovor Gempork fowar- Serviek tenport JaWOx: Servlet. http. +; fenport Java fo. ¥; Public dass srvz2 ewtdS itepservier % Public void service l---) throws $B» 106 Ngererol Services Prinkusriter pws res-gerwesser cs; FOS: SetGontent Type C“iexet/ hm"); Meead reyest param yales Serd Swi frogcam for valt Bole ger poase Tot (reg. getPanameler C*'")), for vola = Inieger ponse Sar (req: get Panam cher (pep); fot Sern = ovegees panse Int Crea: gebPanameter (P)); {G09 e+ revliply valve fot mole vali + valz; Odisploy resuirs Por prion CSev2t sum 79:44Sum); Por Priokln C'seva : rauttiply 182" ¢mul); S'O-P( “Form S$1V2. Program”); Pros dose); {L3web-u0) configure Sra program with “/siurl’ orl-patiero Request UAL to fest the application http: /lecalhosr : 2020/ restoep! | form: him} whor 18 jhe diffrence bewesn rd. focwand ©) and ces.sendeedicect() 2 cd: forward C»-) res- Send Redirect ¢- ¥ perform forward wade of sevier — # Performa Sendaedirectton mode of Gxremuni— chaining cation, ‘The Source Servier Program Communi +The source Servlet program commuaicore® coke® with destieaton Usebresource With destination sevlet Program by paving Program directly. fekwork rOurd fiP with browser window ke The Source Servier program and The source Servier program and destination deShoation Web resource Program uses web resource program will pot use same Same request and response objeas TeWeSt and response object 20 the rewest So request dato coming to source dara. coming to source senile Program is oe Oe ee eee CO visible and accessable in dethaokion accessable i destination webresource: Program: Program # Source servlet program can use ‘append Qwery string request aHribulea@ to send additonal 10 he ort oF response: Send Redlirer() method to Send data jo destination program additional alata from source servier frogram fo desttinalon program: K source Servlet ond destnakon # The sowce Sevier program ond destoation FrogrounB can be there in Same. foc Cle. web application lary server) ee) . hwo dif rent web applicaKor® of Sane can be there In two different server @r) diffusnt servers: wesapplications of seme server Gonly toy few servers) + BeSKAeLIET peagren can be a * DeSHnaHEN prasm can be a seriet 6) a6p eevie © 35p Go ht! Program BDH! God OSPF Pip-mer or) PHP Programs ce, uring forwarding request operation Jel fey the browser address ban will vot Ge changed- During Send Redirection eperation the url th the browser address box will Le changed» {Suitable when source Servlet Program — # suffemle when ec REVEE proymnn ret SU Pe stingien serviek Programm recides — Jesaken Program resides fn tee 400 wre p= naw +Seven tuoonders For_btog Feqpest panameier name bREP!7 twwra-bing -Com | Search 7 9s new + seven+ wonders tweb resource program name For exam source code of above diagram refer applicator @) of the page numbers 43-95 How mary ways one there (0 poss data Lelween the source senler Pragram and destinaton web resource rogram > a 1f source Servier programm and de Stnakon web resource progrard resides Same usb application then uze Merequest atteioutes 2 Session oHvibules B)servier@otenr attribules Tf Source sever Proram and desknahion welo resource program resides In nwo different webapplicakons of Same/ different Cener(S) (eppend query String fo URL Of 725+ Send Redirect (-) method ces. sendRedireck (url 2 "); SOCCEKTOOOIOODCODOD9D00 SOO VOONDSO9O00R bx ces: send Redireck (“http Hocodhost: FoOl/ TestMpp2 /S2.Ur! 2 py FAHbURS albwS US 40 steve only obeCIS- AF we give sieple val = ive Sheple values DP arhitutes then thes ill be Grverted into corapperclass objects and s10 @pi-20"); ° + : © *Ptieibule 18 2 special legical name thar can hold 5. Be ° awa. objecr a2 an value . ° + OFtritoules Provide more vistoi lity and acessabiliy to the dare of 4 3 application crnpare fo the voniablee dedoned in secviet program e ° 2 ° e wil be stored a3 attwtue voles:Se Reavest abiibuies ethepe oneibuiee allocates memary i> reqvest objecr ond they one Visible through out request cucle Browser winds hehe request fv sea 9 oy sey Py, Request oMribules hak ane created "ame servier program of Sevier chaining ane visible fo other servier programs of same servlet chaining because all jre Servier programs of ao servler chaining will uge Same repess ond response objects 4&In the obove diagram the request ativibue created fo Sevi Program ie visitle and accessable fo sev2, Srv3° program but not visible fo srvy program: because SrVI, srV2,/Sr¥3 programa ane USING Same request and response Obie ky ponticgaing th servler chaining and snvy programy 13 pot PANKCIParng fo thar Servier chaining wo creak rewest orhitute req: setAbribute (*pame”, “rojat): GPitavie name Cyatiritue valve req. setAllribule Cage’, new anitger (so); req: SerAkfribuIe (“total”, G00); catribule valve wil bE Corwerted Mato Crapper class objet “ntcoer trough awtoboxing’ To rood request akteitules volves req: setdthibule (name, ‘rajai")s, Freq: SerALIIOMIE Cage”, new Snlege C15))! req: seAtribuic Cota”, $50): tLNOTE: The melted sehOltibule(-,-> can creale naw request ativitule or con modify existing request attribute volue. to read valves fron request attributes Stoing Siz (String) Beq- get ALfribule (name): anteger $2 = Cinkegeryreq- gerdttribure Cage”): rea geththibuie Chorals: for 33. Gonverre wropper dass objet Integer fo so delete) remove rewest offribuie req: remove Atteibute (nome): rey: remove Athibuk Cage” )> req + remove Abinéuie C total") Sesstoo otntute ¥ Session atleitofez allecak2 memory i hep se stople fob through auiounkouing Gnceph session object alloaicZ memory a jhe sever and window 20 fhe session atribuies of ir 10 object. J The http i@ one per browser http session abjeck ane visible ancl acessable i all web resource pegrams ef ub appicakon ‘respective of their reqwest and response ebjeds but Browser window (bY Browser twindowtes) Fhey musk get reqest from that browser wfnolowd for which http session object and TeSIPOPI (web application) _ THB Obbribujes ane created Puy sessron obs 22 22290009930 T7COSOEBDECOTD7TE™7TOOOOOCS eceorceooe>ece wm the session abtribule creakd fo Srvi servlet Program wy getting requesy from wrowser widow wl Iz visible and accessable to all’ ofher servier preqeame of woth opplicalton but they must ger request from Same bragser window bt - ft gegsion alteibulez axe gbbol abtribuleg tn Ihe web applicalvon bur they ane gpecfic 10 a browser window C client) to creak /actess Htkpsession object for browser window on. Sevier Heepsession ses = req,-gerSesston(), erealep or ecole UtipSersion objeor NOTED Ths req: gerSessionc) method checks the. availability of Session otgece on server for browser widdes, if available it Provides access fo thar session object otferwise CIF mot ayoilable) if creates new session objecr Cubepsession object) for browser window on tre servlet: session athibutes eae fo creare ses atinivle or to modify ses atribue value ses: serabieibule CoH” , nav TotegerCs0)): yO read ses arribue vole: SeS_ atirhouie airing SI= CBking) ses- gerAtiribue (YaHe2"), anieger Fewster TO remove ses aHribule e+ romoventtrivue Cakr2”): ServierGntext obtribukes een TV Sewiercntent ortribules altacaie memory fo senterGanier object Since Soviet conser aejecr*ane per exe applicaken ard global memory of webapylicaston fo the servierConles! altribuke ome visible and accessable In all web~ resource programs of web applicakon frespeckive of reqwest and response. objers they ae using and icrespecive of jhe browser window fron which thay axe geting reqvesr tic fhe bebw diagram the servierConlext abtvibule creaied in sev) progran ia wsible and accessable th all the remaining Sevier prosroms of web application frrespeckve of the cequest and response objets they one USing and irrespectve af brewster widow from ushich they ane geting Tevest [ebYou might also likeDurgasoft Core Java Latest1111Document440 pagesDurgasoft Core Java Latest1111Swapnil Erande71% (7)Durga Software Solutions Spring MaterialDocument0 pagesDurga Software Solutions Spring Materialpvkchakravarthi100% (5)Hibernate Notes by Nataraz - JavabynataraJ PDFDocument262 pagesHibernate Notes by Nataraz - JavabynataraJ PDFSunil SoniNo ratings yetMagazinesPodcastsSheet musicANDROID - UI - Material by MR Mahesh at DurgaSoftDocument52 pagesANDROID - UI - Material by MR Mahesh at DurgaSoftSumit Rawal33% (6)Angular 6 NotesDocument93 pagesAngular 6 NotesAnkit Agrawal100% (1)Hibernate Notes by Nataraz JavabynataraJDocument262 pagesHibernate Notes by Nataraz JavabynataraJSomesh SumanNo ratings yetJDBC Notes (Natraz Sir Notes)Document175 pagesJDBC Notes (Natraz Sir Notes)JavaEra.com92% (13)Corejava ConceptsDocument328 pagesCorejava Conceptssumanbezawada100% (1)WebServices Notes PDFDocument94 pagesWebServices Notes PDFSunil SoniNo ratings yetServlets ContextDocument16 pagesServlets ContextkasimNo ratings yet2 PDFDocument553 pages2 PDFSmrutiranjan BiswalNo ratings yetBuilding JSP Pages Using The Expression Language (EL)Document30 pagesBuilding JSP Pages Using The Expression Language (EL)Rahul ChauhanNo ratings yetAdv - Java Means Durga Sir... : Durgasoft, Plot No: 202, Iind Floor, Huda Maitrivanam, Ameerpet, Hyderabad-500038Document14 pagesAdv - Java Means Durga Sir... : Durgasoft, Plot No: 202, Iind Floor, Huda Maitrivanam, Ameerpet, Hyderabad-500038KhanNo ratings yetMVC1 - MVC2 Design PatternDocument6 pagesMVC1 - MVC2 Design PatternkasimNo ratings yet10 FiltersDocument16 pages10 FilterskasimNo ratings yetCore Jave by Ratan PDFDocument286 pagesCore Jave by Ratan PDFeramitsaroha100% (3)Hibernate MaterialDocument71 pagesHibernate MaterialTushar Patil100% (1)JSP FaqsDocument16 pagesJSP FaqsbatmanNo ratings yet11.servlet WrappersDocument14 pages11.servlet WrapperskasimNo ratings yetRaj Technologies Core Java Hand Book - 15 Days V1.0Document109 pagesRaj Technologies Core Java Hand Book - 15 Days V1.0Charan Hamsa100% (1)Ramchandra Corejava NewDocument569 pagesRamchandra Corejava NewPrasad Baithi67% (3)2.client Server ArchDocument14 pages2.client Server ArchkasimNo ratings yetBuilding JSP Pages Using Standard ActionsDocument25 pagesBuilding JSP Pages Using Standard ActionsRahul ChauhanNo ratings yet01 Core Java PDFDocument401 pages01 Core Java PDFKASIM INFONo ratings yetSathish Sir Hibernate Notes Naresh I TechnologiesDocument215 pagesSathish Sir Hibernate Notes Naresh I TechnologiesPrakash93% (14)Spring NotesDocument88 pagesSpring NotesSudheer Reddy PothuraiNo ratings yetCore Java Study FinalDocument410 pagesCore Java Study FinalkoliNo ratings yetInterviw QuestionsDocument13 pagesInterviw QuestionsAshok KumarNo ratings yetJava Means Durgasoft: DURGA SOFTWARE SOLUTIONS, 202 HUDA Maitrivanam, Ameerpet, Hyd. PH: 040-64512786Document12 pagesJava Means Durgasoft: DURGA SOFTWARE SOLUTIONS, 202 HUDA Maitrivanam, Ameerpet, Hyd. PH: 040-64512786ShubhNo ratings yetDurga Sir Java NotesDocument32 pagesDurga Sir Java Notesbhushan laware50% (2)K V Rao Adv Java PDFDocument151 pagesK V Rao Adv Java PDFFeleke AfeworkNo ratings yetSpringDocument5 pagesSpringrambabuNo ratings yetArrays PDFDocument15 pagesArrays PDFHariNo ratings yetSpring Natraj Satya BestDocument236 pagesSpring Natraj Satya BestrushikeshNo ratings yetIntercepting Filter Design PatternDocument8 pagesIntercepting Filter Design Patternkasim0% (1)DurgaSoft JavaDocument2 pagesDurgaSoft JavaSANKET BASU ROYNo ratings yetNote of JavaDocument437 pagesNote of Javasteffan RobertNo ratings yetAngular JSDocument183 pagesAngular JSSumit Singh75% (4)Core JavaDocument177 pagesCore JavaKshirabdhi Tanaya100% (1)1.servlets IntroductionDocument13 pages1.servlets Introductionkasim0% (1)JSP-Servlet Interview Questions You'll Most Likely Be Asked From EverandJSP-Servlet Interview Questions You'll Most Likely Be AskedVibrant PublishersNo ratings yetC & Data Structures From EverandC & Data StructuresProf. P. PadmanabhamNo ratings yetJava servlet Second Edition From EverandJava servlet Second EditionGerardus BlokdykNo ratings yetSql Plsql Oracle From EverandSql Plsql OracleAndrew IglaNo ratings yetEconomía Michael Parkin 8e Cap 1Document16 pagesEconomía Michael Parkin 8e Cap 1lismaryNo ratings yetPDF Parts Catalog Tvs Rockz - CompressDocument104 pagesPDF Parts Catalog Tvs Rockz - CompressaspareteNo ratings yetCharles D Ghilani - Paul R Wolf - Elementary Surveying - An Introduction To Geomatics-Pearson Prentice Hall (2012) - ExtractoDocument19 pagesCharles D Ghilani - Paul R Wolf - Elementary Surveying - An Introduction To Geomatics-Pearson Prentice Hall (2012) - ExtractoRodrigo DelBarrioNo ratings yetIndian Express 19 AugustDocument20 pagesIndian Express 19 AugustTension Dene kaNo ratings yetQuiero Quedarme en Tí (Bone 1 - C)Document1 pageQuiero Quedarme en Tí (Bone 1 - C)avalenciavalderramaNo ratings yet2020Document14 pages2020mintrikpalougoudjoNo ratings yet0002 CHAPTER 21 GENERAL ANESTHETICS Goodman and Gilman The Pharmacological 13th - 4Document18 pages0002 CHAPTER 21 GENERAL ANESTHETICS Goodman and Gilman The Pharmacological 13th - 4Emanuela PereiraNo ratings yetInstallation Fitting 2Document10 pagesInstallation Fitting 2solasi.palastikNo ratings yetAmpacidad AlimentacionDocument1 pageAmpacidad Alimentacionluis miguel sanchez estrellaNo ratings yetBuilding ActDocument136 pagesBuilding ActVeronika RaušováNo ratings yetCanon in D 2Document2 pagesCanon in D 2Kevin ClarkNo ratings yetParadise Violín IIDocument2 pagesParadise Violín IIJavier Rubio PérezNo ratings yet101 Problems in AlgebraDocument160 pages101 Problems in AlgebraTrishaii Cuaresma97% (29)09 - Chapter 1Document20 pages09 - Chapter 1Dr. POONAM KAUSHALNo ratings yetBusiness Startup Guides-Preparing Yourself Ver 2Document4 pagesBusiness Startup Guides-Preparing Yourself Ver 2Minh Huỳnh100% (1)El Pastor - VihuelaDocument1 pageEl Pastor - VihuelaDamian Guardia SalazarNo ratings yetRoot Objects - Alfresco DocumentationDocument10 pagesRoot Objects - Alfresco DocumentationpmrreddyNo ratings yetRollupGroup - UpdateMembersDocument4 pagesRollupGroup - UpdateMemberspmrreddyNo ratings yetUpdate Account Status On Enterprise LevelDocument33 pagesUpdate Account Status On Enterprise Levelpmrreddy100% (1)Using The Javascript Console For Development and AdministrationDocument26 pagesUsing The Javascript Console For Development and AdministrationpmrreddyNo ratings yetMediplus CardDocument1 pageMediplus CardpmrreddyNo ratings yetGet All Alfresco Tags With CMIS - StackDocument4 pagesGet All Alfresco Tags With CMIS - StackpmrreddyNo ratings yet7AY W Ag@Pbae D ? 2) ) - H A'D Agc@Pba BCDocument4 pages7AY W Ag@Pbae D ? 2) ) - H A'D Agc@Pba BCpmrreddyNo ratings yet