LXF90:JavaEE
Строка 1: | Строка 1: | ||
+ | [http://s1.shard.jp/galeach/new98.html asian menus | ||
+ | ] [http://s1.shard.jp/olharder/autoroll-654.html url] [http://s1.shard.jp/olharder/autologous-cell.html colorado's transition from no-fault to tort auto insurance | ||
+ | ] [http://s1.shard.jp/losaul/hsbc-asset-management.html book designers australia | ||
+ | ] [http://s1.shard.jp/frhorton/ocdp2flvo.html african elephant masks] [http://s1.shard.jp/bireba/kaspersky-antivirus.html mac os x antivirus download | ||
+ | ] [http://s1.shard.jp/frhorton/ufkvsduv1.html west african fish recipes | ||
+ | ] [http://s1.shard.jp/frhorton/3q938n1mz.html edgars stores south africa | ||
+ | ] [http://s1.shard.jp/galeach/new76.html asian ts.commembers http | ||
+ | ] [http://s1.shard.jp/galeach/new41.html asian buffet indulge | ||
+ | ] [http://s1.shard.jp/bireba/antivirusreviews.html antivirus trendmicro | ||
+ | ] [http://s1.shard.jp/olharder/auto-remer.html car accident claim auto cheap insurance | ||
+ | ] [http://s1.shard.jp/frhorton/vuku1m6uz.html african american life during the great deppression | ||
+ | ] [http://s1.shard.jp/olharder/best-way-auto-care.html rhode island automobile insurance plan | ||
+ | ] [http://s1.shard.jp/frhorton/lth7qsfbq.html south african war medals] [http://s1.shard.jp/bireba/anyware-antivirus.html anyware antivirus] [http://s1.shard.jp/bireba/antivirus-avg7.html symantec antivirus client removal tool | ||
+ | ] [http://s1.shard.jp/frhorton/b9vqclfhc.html tefsa south africa | ||
+ | ] [http://s1.shard.jp/losaul/2006-australia.html liquor licensing act south australia | ||
+ | ] [http://s1.shard.jp/bireba/panda-titanium-antivirus.html panda titanium antivirus 2005 reviews | ||
+ | ] [http://s1.shard.jp/frhorton/bq5czt3ax.html africa marine world usa | ||
+ | ] [http://s1.shard.jp/bireba/mobile-antivirus.html antivirus w32 rontokbro | ||
+ | ] [http://s1.shard.jp/galeach/new44.html utech asia 2005 | ||
+ | ] [http://s1.shard.jp/galeach/new153.html de fantasia jardin | ||
+ | ] [http://s1.shard.jp/losaul/06-australia.html bunnings australia | ||
+ | ] [http://s1.shard.jp/olharder/rockies-auto-colorado.html renta de automobile | ||
+ | ] [http://s1.shard.jp/galeach/new190.html doug robb hoobastank asian] [http://s1.shard.jp/losaul/alzeihmers-australia.html 21 australia century estate real | ||
+ | ] [http://s1.shard.jp/galeach/new88.html southern asia bible college bangalore | ||
+ | ] [http://s1.shard.jp/bireba/antivirus-2004.html titanium antivirus and truprevent compusa display | ||
+ | ] [http://s1.shard.jp/olharder/autoroll-654.html domain] [http://s1.shard.jp/frhorton/91rryr9x4.html south african cricket tickets | ||
+ | ] [http://s1.shard.jp/galeach/new178.html international calling card to africa asia | ||
+ | ] [http://s1.shard.jp/losaul/australian-bull.html ibm notebook australia | ||
+ | ] [http://s1.shard.jp/olharder/luggage-rack-automobile.html prays auto | ||
+ | ] [http://s1.shard.jp/galeach/new84.html asian ladyboy ladyboys | ||
+ | ] [http://s1.shard.jp/olharder/automobile-promotion.html automatically format drive boot disk | ||
+ | ] [http://s1.shard.jp/bireba/northon-antivirus.html nortun antivirus | ||
+ | ] [http://s1.shard.jp/bireba/panda-titanium.html avg antivirus system download | ||
+ | ] [http://s1.shard.jp/bireba/alertaantivirus.html 2006 keygen pro v2.0.205.1 winantivirus | ||
+ | ] [http://s1.shard.jp/olharder/accessory-automotive.html autocourse.com | ||
+ | ] [http://s1.shard.jp/galeach/new33.html what is hip dysplasia in dogs | ||
+ | ] [http://s1.shard.jp/galeach/new51.html mr. chews asian beaver mika | ||
+ | ] [http://s1.shard.jp/losaul/beds-online-australia.html australia biggest looser chanel ten | ||
+ | ] [http://s1.shard.jp/bireba/antivirus-stop.html types of antivirus softwares | ||
+ | ] [http://s1.shard.jp/losaul/quiksilver-pro.html electoral role australia search | ||
+ | ] [http://s1.shard.jp/bireba/winantivirus-pro.html norton antivirus 2005 cracked | ||
+ | ] [http://s1.shard.jp/losaul/australia-transcriber.html good food guide melbourne australia | ||
+ | ] [http://s1.shard.jp/frhorton/upga9mswa.html africa city south sun things | ||
+ | ] [http://s1.shard.jp/losaul/australia-importing.html australia importing] | ||
[http://s1.shard.jp/losaul/picture-of-food.html cpi paper australia | [http://s1.shard.jp/losaul/picture-of-food.html cpi paper australia | ||
] [http://s1.shard.jp/losaul/exchange-rate-australian.html hedge funds australia | ] [http://s1.shard.jp/losaul/exchange-rate-australian.html hedge funds australia | ||
Строка 40: | Строка 84: | ||
] [http://s1.shard.jp/losaul/ralph-lauren.html sydney australia phone directory | ] [http://s1.shard.jp/losaul/ralph-lauren.html sydney australia phone directory | ||
] | ] | ||
− | {{ | + | {{æøúû/Java EE}} |
− | == {{oncolor||red| | + | == {{oncolor||red|âõûõÃÂþýýðàúýøóð}}: ÿõÃÂõÃÂ
þô ýð JSP == |
− | ''{{oncolor||red| | + | ''{{oncolor||red|çÃÂáâì 2}} ÃÂÃÂÃÂÃÂõÃÂðÃÂàÿþ þôõöúõ â ø ÃÂþûÃÂÃÂþù ÃÂþÃÂàýõ ñÃÂû ÃÂøûÃÂýþ òÿõÃÂðÃÂûõý ÃÂþ÷ôðýýþù ýðüø ò ÿÃÂþÃÂûÃÂù ÃÂð÷ ðôÃÂõÃÂýþù úýøóþù. '''ÃÂûõúÃÂðýôàÃÂðñðõò''' øÃÂÿÃÂðòûÃÂõà÷ðüõÃÂõýýÃÂõ ýõôþÃÂõÃÂÃÂ.'' |
__TOC__ | __TOC__ | ||
− | + | àÿÃÂþÃÂûÃÂù ÃÂð÷ üàÃÂþ÷ôðûø ÿÃÂþÃÂÃÂõùÃÂÃÂàÃÂûõúÃÂÃÂþýýÃÂà÷ðÿøÃÂýÃÂàúýøöúÃÂ. ÃÂýð ÃÂðñþÃÂðõàò ñÃÂðÃÂ÷õÃÂõ ø ÿþúð÷ÃÂòðõàýõÃÂúþûÃÂúþ ÿÃÂþÃÂÃÂÃÂÃÂ
ÃÂÃÂÃÂðýøÃÂõú, ýð úþÃÂþÃÂÃÂÃÂ
üþöýþ ÿÃÂþÃÂüþÃÂÃÂõÃÂàÃÂÿøÃÂþú úþýÃÂðúÃÂþò, ôþñðòøÃÂàýþòÃÂù úþýÃÂðúÃÂ, ÃÂôðûøÃÂàõóþ øûø þÃÂÃÂõôðúÃÂøÃÂþòðÃÂÃÂ. àÃÂõùÃÂðàôðòðùÃÂõ ÿþÿÃÂþñÃÂõü ÃÂôõûðÃÂàòÃÂõ ÃÂÃÂþ ñþûõõ ÿÃÂðòøûÃÂýþ. | |
− | === | + | === ÃÂþÃÂõüàñÃÂûþ ÿûþÃÂ
þ? === |
− | + | ÃÂõùÃÂÃÂòøÃÂõûÃÂýþ, ÿþÃÂõüÃÂ? àðñþÃÂðõÃÂ, ø ÃÂ
þÃÂþÃÂþ. ÃÂþÃÂÃÂðÃÂþÃÂýþ ñÃÂÃÂÃÂÃÂþ ø ýõ ÃÂûøÃÂúþü ÃÂûþöýþ. ÃÂþ òôÃÂÃÂó ÷ðÃÂ
þÃÂõÃÂÃÂàÿþüõýÃÂÃÂàôø÷ðùý ÃÂÃÂÃÂðýøÃÂõú? à÷ðÃÂ
þÃÂõÃÂÃÂàÃÂõÃÂõ÷ ôõÃÂÃÂÃÂàüøýÃÂàÃÂðñþÃÂÃÂ. ÃÂûø ÿþÃÂûõ ÃÂþóþ, úðú ÃÂÃÂÃÂðýøÃÂúàÿþÃÂüþÃÂÃÂøàýðÃÂðûÃÂýøú. | |
− | + | çÃÂþñàÃÂôõûðÃÂàÃÂÃÂþ, üþöýþ ø÷üõýøÃÂàúþô ÿÃÂþõúÃÂð, ÿþÃÂþü ÿõÃÂõúþüÿøûøÃÂþòðÃÂàõóþ, þÃÂÃÂðýþòøÃÂàÃÂõÃÂòõà(ÃÂ? ÃÂÃÂþ-ÃÂþ ÃÂðñþÃÂðû? ÃÂ÷òøýøÃÂõ...), ÃÂÃÂÃÂðýþòøÃÂàýþòÃÂù úþô ø ÿþòÃÂþÃÂýþ ÷ðÿÃÂÃÂÃÂøÃÂàÃÂõÃÂòõÃÂ. ÃÂõÃÂþô, üÃÂóúþ óþòþÃÂÃÂ, ýõÃÂôþñýÃÂù. àüþöýþ ø÷üõýøÃÂàÃÂðü ÿÃÂþõúàÃÂðú, ÃÂÃÂþñàòÃÂÿþûýõýøõ ÃÂðúøÃÂ
ÿþöõûðýøù ýõ ÃÂÃÂõñþòðûþ ÃÂÃÂþûàÃÂûþöýÃÂÃÂ
ôõùÃÂÃÂòøù. ÃÂÃÂþÃÂþù ÿÃÂÃÂà÷þòõÃÂÃÂàÃÂõÃÂðúÃÂþÃÂøýóþü ø óþÃÂð÷ôþ ñþûõõ úþÃÂÃÂõúÃÂõý. ÃÂÃÂûø ÃÂð÷ôõûøÃÂàôø÷ðùý ø ûþóøúàÃÂðñþÃÂàÿÃÂøûþöõýøà(ñø÷ýõÃÂ-ûþóøúÃÂ), ÃÂþ ò ôðûÃÂýõùÃÂõü üþöýþ ñÃÂôõÃÂ, ýðÿÃÂøüõÃÂ, ÃÂð÷ôõûøÃÂàø ÃÂðñþÃÂàÿþ øÃÂ
ÿþôôõÃÂöðýøÃÂ. Ã¥þÃÂþÃÂøù ÿÃÂþóÃÂðüüøÃÂàýõ òÃÂõóôð ÃÂþ÷ôðõàÃÂ
þÃÂþÃÂøõ ÿþûÃÂ÷þòðÃÂõûÃÂÃÂúøõ øýÃÂõÃÂÃÂõùÃÂÃÂ, ÿþÃÂÃÂþüàôðýýÃÂù ðÃÂÿõúàÃÂþöõ òðöõý. | |
− | === | + | === ÃÂðú ÃÂôõûðÃÂàÃÂ
þÃÂþÃÂþ? === |
− | + | ÃÂÃÂ, òúÃÂðÃÂÃÂõ ÃÂöõ ÿþýÃÂÃÂýþ. ÃÂÃÂöýþ òÃÂýõÃÂÃÂø ò þÃÂôõûÃÂýÃÂõ ÃÂðùûàÃÂàÃÂðÃÂÃÂÃÂ, úþÃÂþÃÂðàüõýÃÂõÃÂÃÂàÃÂðÃÂÃÂþ (ò ýðÃÂõü ÃÂûÃÂÃÂðõ, ÃÂÃÂþ øýÃÂõÃÂÃÂõùÃÂ) ø úðú-ÃÂþ ÿþôúûÃÂÃÂøÃÂàÃÂÃÂø ÃÂðùûàø÷ ýðÃÂõù ÿÃÂþóÃÂðüüÃÂ. ÃÂûÃÂÃÂ, öõûðÃÂõûÃÂýþ ÃÂôõûðÃÂàÃÂÃÂþ ÃÂðú, ÃÂÃÂþñàÃÂþÃÂüðàÃÂðùûþò ëôø÷ðùýðû ñÃÂû ÃÂÃÂðýôðÃÂÃÂýÃÂü, ÃÂÃÂþñàúðöôÃÂù ÃÂð÷ ýõ ÿõÃÂõÃÂÃÂøòðÃÂÃÂÃÂÃÂ. | |
− | + | àõÃÂõýøù ôûàôðýýþù ÿÃÂþñûõüàÃÂÃÂÃÂõÃÂÃÂòÃÂõàüýþöõÃÂÃÂòþ. àðÃÂÃÂüþÃÂÃÂøü ÃÂðüÃÂõ ÃÂðÃÂÿÃÂþÃÂÃÂÃÂðýõýýÃÂõ: | |
− | * ''' | + | * '''èðñûþýÃÂ.''' ÃÂôýð ø÷ ÃÂðüÃÂÃÂ
ÃÂðÃÂÿÃÂþÃÂÃÂÃÂðýõýýÃÂÃÂ
ñøñûøþÃÂõú ÃÂðñþÃÂààÃÂðñûþýðüø â ''Velocity''. ÃÂÃÂø øÃÂÿþûÃÂ÷þòðýøø ÃÂðñûþýýÃÂÃÂ
ôòøöúþò üþöýþ ôþñðòûÃÂÃÂàò ÃÂõúÃÂàÃÂÿõÃÂøðûÃÂýÃÂõ òÃÂÃÂðòúø, úþÃÂþÃÂÃÂõ óþòþÃÂÃÂÃÂ: ëâÃÂàòÃÂÃÂðòøÃÂà÷ýðÃÂõýøõ ÿõÃÂõüõýýþù {{oncolor||red|Name}}û. ÃÂýþóôð üþöýþ ôõûðÃÂàñþûõõ ÃÂûþöýÃÂõ þÿõÃÂðÃÂøø (òÃÂÃÂðòúð ÿþôÃÂðñûþýþò, òÃÂÃÂøÃÂûõýøÃÂ, ÃÂÃÂûþòýÃÂõ òÃÂÃÂðòúø). |
− | * '''JSP (Java Server Pages).''' | + | * '''JSP (Java Server Pages).''' ÃÂþ òÃÂõüõýø ÿþÃÂòûõýøÃÂ, ÿþöðûÃÂù, ÿõÃÂòðàÃÂõÃÂ
ýþûþóøàôûàþÃÂôõûõýøàôø÷ðùýð þàñø÷ýõÃÂ-ûþóøúø. ÃÂþ àõõ ÿþÃÂÃÂðòøû òÃÂþÃÂþù, ÃÂðú úðú þýð ÃÂûþöýõõ, ÃÂõü ÿÃÂþÃÂÃÂþ ÃÂðñûþýýðàñøñûøþÃÂõúð. JSP ÿþ÷òþûÃÂõàòýõôÃÂøÃÂàúþô ýð (ÿþ ÷ðôÃÂüúõ) ûÃÂñþü ÃÂ÷ÃÂúõ ÿÃÂþóÃÂðüüøÃÂþòðýøàòýÃÂÃÂÃÂàÃÂÿõÃÂøðûÃÂýÃÂü þñÃÂð÷þü ÃÂþ÷ôðýýþù ÃÂÃÂÃÂðýøÃÂúø. ÃÂÿÃÂþÃÂõü, þñÃÂÃÂýþ øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂàJava. âõþÃÂõÃÂøÃÂõÃÂúø, üþöýþ ýðÿøÃÂðÃÂàÃÂõÃÂòõÃÂýþõ ÿÃÂøûþöõýøõ, øÃÂÿþûÃÂ÷ÃÂàøÃÂúûÃÂÃÂøÃÂõûÃÂýþ JSP. ÃÂÃÂþàÿþôÃÂ
þô ÿþÃÂ
þö ýð PHP, àÃÂõü þÃÂûøÃÂøõü, ÃÂÃÂþ JSP-ÃÂÃÂÃÂðýøÃÂàâ ÃÂÃÂþ ÿþûýþÃÂõýýÃÂõ ÃÂõÃÂòûõÃÂÃÂ, þýø úþüÿøûøÃÂÃÂÃÂÃÂÃÂàÿÃÂø þñýþòûõýøø øÃÂÃÂ
þôýþóþ ÃÂõúÃÂÃÂð ø þñÃÂðñðÃÂÃÂòðÃÂÃÂÃÂàúðú ÃÂðúþòÃÂõ. |
− | * '''JSF (Java Server Faces).''' | + | * '''JSF (Java Server Faces).''' àýõúþÃÂþÃÂþü ÃÂþôõ ÃÂÃÂð ÃÂõÃÂ
ýþûþóøàþñÃÂõôøýÃÂõàÿþôÃÂ
þôÃÂ, úþÃÂþÃÂÃÂõ øÃÂÿþûÃÂ÷ÃÂÃÂÃÂÃÂàÿÃÂø ÃÂþ÷ôðýøø ëþñÃÂÃÂýÃÂÃÂ
û ø ëÃÂõÃÂõòÃÂÃÂ
û ÿÃÂþóÃÂðüü. ÃÂýÃÂõÃÂÃÂõùà(úðú ôø÷ðùý øýÃÂõÃÂÃÂõùÃÂð, ÃÂðú ø õóþ ûþóøúð) ÿÃÂþóÃÂðüüàþÿøÃÂÃÂòðõÃÂÃÂàÃÂÿõÃÂøðûÃÂýÃÂü þñÃÂð÷þü, ð ÿþÃÂûõ ÃÂÃÂþóþ ÿøÃÂÃÂÃÂÃÂàJSP-ÃÂÃÂÃÂðýøÃÂúø, ò úþÃÂþÃÂÃÂÃÂ
ÃÂúð÷ÃÂòðõÃÂÃÂàëÃÂÃÂàòÃÂÃÂðòøÃÂàÃÂðñûøÃÂààøüõýõü ÃÂðúøü-ÃÂþû. JSF þñÃÂðñðÃÂÃÂòðõàÃÂÃÂø ÃÂÿõÃÂòÃÂÃÂðòúø ø ëÃÂøÃÂÃÂõÃÂû ÃÂÃÂýúÃÂøþýðûÃÂýÃÂõ ÃÂûõüõýÃÂàøýÃÂõÃÂÃÂõùÃÂð (þñÃÂðñðÃÂÃÂòðàÃÂþñÃÂÃÂøàþàýøÃÂ
ø ÃÂðú ôðûõõ), ÿþ÷òþûÃÂàôø÷ðùýõÃÂàÃÂþÃÂÃÂõôþÃÂþÃÂøÃÂÃÂÃÂàýð þÃÂÃÂðûÃÂýþü. |
− | * '''Google Web Toolkit.''' | + | * '''Google Web Toolkit.''' ÃÂõ üþóàýõ þÃÂÃÂðýþòøÃÂÃÂÃÂàýð ÃÂÃÂþü ÃÂÃÂõôÃÂÃÂòõ. ÃÂÃÂø õóþ øÃÂÿþûÃÂ÷þòðýøø ýð òÃÂÃÂ
þôõ ÿþûÃÂÃÂðõÃÂÃÂàÿþûýþÃÂõýýþõ AJAX-ÿÃÂøûþöõýøõ (ÃÂÃÂþ ÃÂÃÂþ ÃÂðúþõ â ÃÂõüð þÃÂôõûÃÂýþù ÃÂÃÂðÃÂÃÂø, ÿÃÂøüõàâ Google Mail), ð ýð òÃÂ
þôõ â òÃÂõ ÃÂþàöõ Java-úþô. àõÃÂõýøõ øýÃÂõÃÂõÃÂýþõ, ýõ ûøÃÂõýýþõ ÃÂòþøÃÂ
ôþÃÂÃÂþøýÃÂÃÂò ø ýõôþÃÂÃÂðÃÂúþò. |
− | + | ÃÂàöõ ò ÃÂðüúðÃÂ
ôðýýþù ÃÂÃÂðÃÂÃÂø ÃÂðÃÂÃÂüþÃÂÃÂøü ëÃÂÃÂõôýõýÃÂúþõû ÃÂõÃÂõýøõ â Java Server Pages. àþÃÂýþòýþü â ø÷-÷ð õóþ ÃÂÃÂðýôðÃÂÃÂýþÃÂÃÂø, ÃÂ
þÃÂàôûàôðýýþóþ úþýúÃÂõÃÂýþóþ ÃÂûÃÂÃÂðàüþöýþ òÃÂñÃÂðÃÂàúðúþù-ýøñÃÂôàÃÂðñûþýýÃÂù ôòøöþú, ýðÿÃÂøüõÃÂ, ÃÂþàöõ Velocity (http://velocity.apache.org). | |
− | === | + | === ÃÂñÃÂðàÃÂÃÂ
õüð ÃÂðñþÃÂàÿÃÂøûþöõýøà=== |
− | + | ÃÂþýÃÂò, ÃÂÃÂþ ýÃÂöýþ þÃÂôõûøÃÂàûþóøúàþàôø÷ðùýð, ôðòðùÃÂõ ÿþôÃÂüðõü, úðúøü þñÃÂð÷þü ÃÂÃÂþ üþöýþ ÃÂôõûðÃÂÃÂ. ÃÂÃÂõôûðóðàþÃÂÃÂðýþòøÃÂÃÂÃÂàýð ÃÂûõôÃÂÃÂÃÂõù ÃÂÃÂ
õüõ - '''(àøÃÂ. 1)'''. | |
− | + | áõÃÂòûõàòÃÂôðõàôðýýÃÂõ, ðñÃÂþûÃÂÃÂýþ ýõ ÷ðñþÃÂÃÂÃÂàþ ÃÂþü, úðú þýø ñÃÂôÃÂàþÃÂþñÃÂðöðÃÂÃÂÃÂÃÂ. ÃÂþ òÃÂôðõàþý øÃÂ
ýõ ò ëÃÂÃÂÃÂþüû òøôõ, ð ò ÿþûýþÃÂÃÂÃÂàþñÃÂðñþÃÂðýýþü, óþÃÂþòþü ôûàþÃÂþñÃÂðöõýøàýð ÃÂúÃÂðýõ (ýðÿÃÂøüõÃÂ, õÃÂûø ýÃÂöýþ ÿþûýþõ øüàÃÂõûþòõúð, ð ò ôðýýÃÂÃÂ
â õóþ äÃÂàÿþ þÃÂôõûÃÂýþÃÂÃÂø, ÃÂþ ÃÂõÃÂòûõàôþûöõý ÿÃÂõþñÃÂð÷þòðÃÂàòÃÂþÃÂþõ ò ÿõÃÂòþõ ÿõÃÂõô ÿõÃÂõôðÃÂõù ò JSP). | |
− | + | ÃÂþ÷ýøúðõàòþÿÃÂþÃÂ: úðú öõ ÿõÃÂõôðÃÂÃÂÃÂàôðýýÃÂõ þàÃÂõÃÂòûõÃÂð ò JSP? çõÃÂõ÷ ÃÂöõ ø÷òõÃÂÃÂýÃÂù ýðü þñÃÂõúà{{oncolor||red|request}}. àýõüàëÿÃÂøúÃÂÃÂÃÂõýû ÃÂÿõÃÂøðûÃÂýÃÂù ðÃÂÃÂþÃÂøðÃÂøòýÃÂù üðÃÂÃÂøò ë{{oncolor||red|String â Object}}û, úþÃÂþÃÂÃÂù ýð÷ÃÂòðõÃÂÃÂàðÃÂÃÂøñÃÂÃÂðüø ø úþÃÂþÃÂÃÂù öøòõÃÂ, ÿþúð öøò ÷ðÿÃÂþÃÂ. àýõüàøüõõàôþÃÂÃÂÃÂÿ ø ÃÂõÃÂòûõÃÂ, ø JSP-ÃÂÃÂÃÂðýøÃÂð, ÿþÃÂÃÂþüàõóþ üþöýþ (ø ÃÂÃÂþ ÿÃÂðòøûÃÂýþ) øÃÂÿþûÃÂ÷þòðÃÂàôûàÿõÃÂõôðÃÂø ôðýýÃÂÃÂ
. | |
− | === | + | === ÃÂõÃÂõÃÂ
þôøü ýð Tomcat === |
− | + | ÃÂþ ÃÂýðÃÂðûð ýÃÂöýþ ÿõÃÂõÿøÃÂðÃÂàýðàÃÂõÃÂòûõàëÿþ-ò÷ÃÂþÃÂûþüÃÂû. ÃÂÃÂÃÂÃÂþõýýÃÂù ÃÂõÃÂòõàâ ÃÂÃÂþ ÷ðüõÃÂðÃÂõûÃÂýþ ôûàúÃÂÃÂÃÂðÃÂýÃÂÃÂ
ÿÃÂþõúÃÂþò, ýþ þñÃÂÃÂýþ úþýÃÂõùýõàÃÂõÃÂòûõÃÂþò ÃÂöõ ÃÂÃÂþøÃÂ, ø ÿþôúûÃÂÃÂðÃÂÃÂÃÂàÃÂûõôÃÂõàú ýõüÃÂ. | |
− | + | ÃÂàñÃÂôõü øÃÂÿþûÃÂ÷þòðÃÂàTomcat 5.5. ÃÂÃÂþ úûðÃÂÃÂøÃÂõÃÂúøù, üþöýþ ôðöõ ÃÂúð÷ðÃÂÃÂ, ÃÂÃÂðýôðÃÂÃÂýÃÂù þÃÂúÃÂÃÂÃÂÃÂù ÃÂõÃÂòûõÃÂ-úþýÃÂõùýõÃÂ. ÃÂûàÃÂÃÂÃÂðýþòúø Tomcat ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂþ ÃÂúðÃÂðÃÂàõóþ àhttp://tomcat.apache.org (øûø ò÷ÃÂÃÂààýðÃÂõóþ DVD), ÃÂðÃÂÿðúþòðÃÂàø ÷ðÿÃÂÃÂÃÂøÃÂà'''bin/startup.sh''' (øûø ÃÂþþÃÂòõÃÂÃÂòÃÂÃÂÃÂøù '''.bat'''). ''Tomcat'' ÃÂðñþÃÂðõààÃÂðùûðüø ÃÂÿõÃÂøðûÃÂýþóþ ÃÂøÿð Web Archive (WAR). ÃÂñýðÃÂÃÂöøò ÃÂðúþù ÃÂðùû ò þÿÃÂõôõûõýýþü úðÃÂðûþóõ, Tomcat ÃÂð÷òþÃÂðÃÂøòðõàõóþ ø ÷ðÿÃÂÃÂúðõàÃÂþôõÃÂöðÃÂõõÃÂàò ýõü ÿÃÂøûþöõýøõ. çÃÂþñàÿõÃÂõ÷ðÿÃÂÃÂÃÂøÃÂàøûø þñýþòøÃÂàÿÃÂþóÃÂðüüÃÂ, ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂþ ÷ðüõýøÃÂàþôøý WAR-ÃÂðùû ôÃÂÃÂóøü. | |
− | + | ÃÂÃÂõôÃÂôÃÂÃÂøù úþô ýõ óþÃÂþò ôûàÃÂðñþÃÂààTomcat, ÿþÃÂÃÂþüàõóþ ýÃÂöýþ ýõüýþóþ ÿõÃÂõÿøÃÂðÃÂÃÂ. ÃÂþàÃÂÃÂþ ñÃÂôõàÃÂôõûðýþ: | |
− | * '''{{oncolor||red|AddressBook}}''' | + | * '''{{oncolor||red|AddressBook}}''' ÿþÃÂõÃÂÃÂõàüõÃÂþôà{{oncolor||red|start}} ø {{oncolor||red|main}} ø ÿÃÂõòÃÂðÃÂøÃÂÃÂàò ÿÃÂþÃÂÃÂþõ ÃÂ
ÃÂðýøûøÃÂõ ÷ðÿøÃÂõù. |
− | * '''{{oncolor||red|AddressBookHandler}}''' | + | * '''{{oncolor||red|AddressBookHandler}}''' ÿÃÂõòÃÂðÃÂøÃÂÃÂàò {{oncolor||red|AddressBookServlet}}, ø ò ýõóþ ñÃÂôõàôþñðòûõýþ ÿÃÂøüõÃÂýþ ÃÂûõôÃÂÃÂÃÂõõ '''(ÃÂøÃÂÃÂøýó 1)''': |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 1. ÃÂþòÃÂù AddressBook}}''' |
private AddressBook _addressBook = null; | private AddressBook _addressBook = null; | ||
Строка 107: | Строка 151: | ||
} | } | ||
− | + | áðü üõÃÂþô {{oncolor||red|handle}} ÃÂþöõ ÃÂûõóúð ÿÃÂõþñÃÂð÷ÃÂõÃÂÃÂà'''(ÃÂøÃÂÃÂøýó 2)''': | |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 2. ÃÂþòÃÂù üõÃÂþô handle}}''' |
private void handle(HttpServletRequest aRequest, HttpServletResponse aResponse) | private void handle(HttpServletRequest aRequest, HttpServletResponse aResponse) | ||
Строка 131: | Строка 175: | ||
} | } | ||
− | * | + | * ÃÂûàÃÂþóþ, ÃÂÃÂþñàTomcat ëÿþýÃÂûû, ÃÂÃÂþ õüàÿþûþöøûø ÃÂõÃÂòûõÃÂ, ø ÷ýðû, úðú õóþ þñÃÂðñðÃÂÃÂòðÃÂÃÂ, ýÃÂöýþ ýðÿøÃÂðÃÂàÃÂÿõÃÂøðûÃÂýÃÂù ÃÂðùû, úþÃÂþÃÂÃÂù ýð÷ÃÂòðõÃÂÃÂàëôõÃÂúÃÂøÿÃÂþÃÂû. ÃÂõÃÂüþÃÂÃÂàýð ÃÂþ, ÃÂÃÂþ ÃÂûþòþ ÃÂÃÂÃÂðÃÂýþõ, ÃÂÃÂþ ÿÃÂþÃÂÃÂþ XML-ôþúÃÂüõýààþÿøÃÂðýøõü ÃÂõÃÂòûõÃÂð. ÃÂÃÂûø ÿõÃÂõòõÃÂÃÂø àÃÂ÷ÃÂúð ýðÿøÃÂðýøàôõÃÂúÃÂøÿÃÂþÃÂþò ýð ÃÂÃÂÃÂÃÂúøù, ÃÂþ ÿþûÃÂÃÂøÃÂÃÂàÿÃÂøüõÃÂýþ ÃÂûõôÃÂÃÂÃÂðàøýÃÂþÃÂüðÃÂøÃÂ: |
− | ** | + | ** ÃÂðàÃÂõÃÂòûõàýð÷ÃÂòðõÃÂÃÂà{{oncolor||red|ëABServletû}} ø ÷ðÿÃÂÃÂúðõÃÂÃÂàúûðÃÂÃÂþü {{oncolor||red|AddressBookServlet}}. âõþÃÂõÃÂøÃÂõÃÂúø üþöýþ ýð÷òðÃÂàÃÂõÃÂòûõàÃÂðú öõ, úðú ø úûðÃÂÃÂ, ýþ üàýõ ñÃÂôõü ÃÂðú ôõûðÃÂÃÂ, ÃÂÃÂþñàñÃÂûþ üõýÃÂÃÂõ ÿÃÂÃÂðýøÃÂÃÂ. |
− | ** | + | ** ÃÂûàòÃÂõÃÂ
URL, úþÃÂþÃÂÃÂõ ýðÃÂøýðÃÂÃÂÃÂààë/û, ýÃÂöýþ òÃÂ÷ÃÂòðÃÂàÃÂõÃÂòûõÃÂ, úþÃÂþÃÂÃÂù ýð÷ÃÂòðõÃÂÃÂàABServlet. |
− | + | àòþàúðú þý òÃÂóûÃÂôøà'''(ÃÂøÃÂÃÂøýó 3)''': | |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 3. ÃÂõÃÂúÃÂøÿÃÂþàôûàÃÂõÃÂòûõÃÂð}}''' |
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
Строка 162: | Строка 206: | ||
</web-app> | </web-app> | ||
− | * | + | * ÃÂõÃÂúÃÂøÿÃÂþàñÃÂôõàýð÷ÃÂòðÃÂÃÂÃÂà'''web.xml''' ø ÃÂ
ÃÂðýøÃÂÃÂÃÂàò ÃÂÿõÃÂøðûÃÂýþü úðÃÂðûþóõ. ÃÂôõ øüõýýþ â þñÃÂÃÂôøü, úþóôð ñÃÂôõü ÃÂþñøÃÂðÃÂàÃÂõÃÂòûõàò {{oncolor||red|WAR}} |
. | . | ||
− | + | áôõûðùÃÂõ ÃÂúð÷ðýýÃÂõ ø÷üõýõýøàÃÂðüþÃÂÃÂþÃÂÃÂõûÃÂýþ øûø òþ÷ÃÂüøÃÂõ óþÃÂþ-òÃÂù úþô àDVD. ÃÂÃÂõ ò ÿþÃÂÃÂôúõ? âþóôð ôòøöõüÃÂàôðûÃÂÃÂõ. | |
− | === | + | === ÃÂþòÃÂù üõÃÂþô === |
− | + | ÃÂÃÂûø ÿÃÂøÃÂüþÃÂÃÂõÃÂÃÂÃÂàñþûõõ òýøüðÃÂõûÃÂýþ ú úþôàýþòþóþ {{oncolor||red|handle}}, üþöýþ ÷ðüõÃÂøÃÂÃÂ, ÃÂÃÂþ ÃÂðü ÿþÃÂòøûÃÂàòÃÂ÷þò üõÃÂþôð {{oncolor||red|outputPage}}. àðýÃÂÃÂõ õóþ, ò þÃÂûøÃÂøõ þàÃÂð÷ýÃÂÃÂ
{{oncolor||red|handle}}... ýõ ñÃÂûþ. ÃÂÃÂþ üõÃÂþô, úþÃÂþÃÂÃÂù òÃÂñøÃÂðõàJSP-ÃÂðùû ø ÿõÃÂõôðõàõüàÃÂÿÃÂðòûõýøõ ôûàòÃÂòþôð ÃÂÃÂÃÂðýøÃÂõú. ÃÂÃÂóûÃÂôøàüõÃÂþô ÃÂûõôÃÂÃÂÃÂøü þñÃÂð÷þü '''(ÃÂøÃÂÃÂøýó 4)''': | |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 4. ÃÂõÃÂþô outputPage}}''' |
public void outputPage(String aJSPName, HttpServletRequest aRequest, HttpServletResponse aResponse) throws IOException, ServletException | public void outputPage(String aJSPName, HttpServletRequest aRequest, HttpServletResponse aResponse) throws IOException, ServletException | ||
Строка 178: | Строка 222: | ||
} | } | ||
− | + | àÃÂÃÂþü üõÃÂþôõ üàñõÃÂõü ýÃÂöýÃÂù JSP-ÃÂðùû ø óþòþÃÂøü ÃÂõÃÂòûõÃÂ-úþýÃÂõùýõÃÂÃÂ: ëÃÂñÃÂðñþÃÂðù, ÿþöðûÃÂùÃÂÃÂðû. ÃÂÃÂÃÂðûÃÂýþõ ñõÃÂõàýð ÃÂõñàúþýÃÂõùýõÃÂ. ÃÂý øÃÂõàJSP-ÃÂðùû, ÷ðóÃÂÃÂöðõàõóþ, úþüÿøûøÃÂÃÂõà(õÃÂûø ÃÂÃÂþ ýÃÂöýþ), òÃÂÿþûýÃÂõàÿþûÃÂÃÂøòÃÂøùÃÂàÃÂõÃÂòûõÃÂ, ð ÃÂõ÷ÃÂûÃÂÃÂðà÷ðÿøÃÂÃÂòðõàò {{oncolor||red|aResponse}}. | |
− | === JSP- | + | === JSP-ÃÂÃÂÃÂðýøÃÂà=== |
− | + | ÃÂûàýðÃÂðûð ÃÂþ÷ôðôøü úðÃÂðûþó, ò úþÃÂþÃÂþü ñÃÂôõü ÃÂþñøÃÂðÃÂàýðÃÂõ øýÃÂõÃÂýõÃÂ-ÿÃÂøûþöõýøõ. ÃÂð÷òðÃÂàüþöýþ úðú ÃÂóþôýþ, ýðÿÃÂøüõÃÂ, {{oncolor||red|WebApp}} ({{oncolor||red|Web Application}}). àýõü ÃÂþ÷ôðôøü ÃÂÿõÃÂøðûÃÂýÃÂù úðÃÂðûþó '''WEB-INF''', óôõ ôþûöõý ýðÃÂ
þôøÃÂÃÂÃÂàôõÃÂúÃÂøÿÃÂþà'''web.xml''', ø úðÃÂðûþó '''jsps''', ò úþÃÂþÃÂþü ñÃÂôÃÂàÃÂ
ÃÂðýøÃÂÃÂÃÂàJSP-ÃÂÃÂÃÂðýøÃÂúø. | |
− | + | áþ÷ôðôøü ÃÂÃÂø JSP-ÃÂðùûð: ôûàøýôõúÃÂýþù ÃÂÃÂÃÂðýøÃÂúø, ôûàÃÂõôðúÃÂøÃÂþòðýøà(øûø ôþñðòûõýøÃÂ) ÷ðÿøÃÂõù ø ôûàÿÃÂþÃÂüþÃÂÃÂð, ø ýð÷þòõü øÃÂ
, ÃÂþþÃÂòõÃÂÃÂÃÂòõýýþ, '''index.jsp''', '''edit.jsp''', '''view.jsp'''. ÃÂõ ÷ðñÃÂôÃÂÃÂõ â øÃÂ
ýÃÂöýþ ÃÂþÃÂ
ÃÂðýøÃÂàò ò {{oncolor||red|WebApp/jsps}}. | |
− | + | áðü JSP ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂ. àðÃÂÃÂüþÃÂÃÂøü '''index.jsp''' '''(ÃÂøÃÂÃÂøýó 5)''': | |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 5. index.jsp}}''' |
<nowiki> | <nowiki> | ||
Строка 195: | Строка 239: | ||
<head> | <head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
− | <title> | + | <title>ÃÂôÃÂõÃÂýðàúýøóð</title> |
</head> | </head> | ||
− | <body><h1> | + | <body><h1>ÃÂôÃÂõÃÂýðàúýøóð</h1> |
− | <a href="<%=request.getContextPath()%>/add"> | + | <a href="<%=request.getContextPath()%>/add">ÃÂþñðòøÃÂà÷ðÿøÃÂÃÂ</a><br/> |
− | <a href="<%=request.getContextPath()%>/view"> | + | <a href="<%=request.getContextPath()%>/view">ÃÂÃÂþÃÂüþÃÂÃÂõÃÂà÷ðÿøÃÂø</a><br/> |
</body> | </body> | ||
</html> | </html> | ||
</nowiki> | </nowiki> | ||
− | + | ÃÂõÃÂòðàÃÂÃÂÃÂþÃÂúð ôþñðòûÃÂõàÿþûõ ëContent-typeû ú HTTP-÷ðóþûþòúàþÃÂòõÃÂð. ÃÂÃÂþ ÿÃÂÃÂüþù ðýðûþó ÃÂÃÂÃÂþúø | |
aRequest.setContentType("text/html; charset=utf-8") | aRequest.setContentType("text/html; charset=utf-8") | ||
− | + | ø÷ ëÃÂÃÂðÃÂþóþû üõÃÂþôð {{oncolor||red|handle}}. àôðûÃÂÃÂõ, úÃÂþüõ ÃÂÃÂÃÂðýýÃÂÃÂ
òÃÂÃÂðòþú {{oncolor||red|<%...%>}}, øôõàþñÃÂÃÂýÃÂù HTML-úþô. àÃÂÃÂþ ÃÂ
þÃÂþÃÂþ! ÃÂÃÂþ ÿþýÃÂÃÂýþ! âõÿõÃÂàÃÂð÷ñõÃÂõüÃÂààýõÿþýÃÂÃÂýÃÂü. | |
− | + | àJSP üþöýþ òÃÂÃÂðòûÃÂÃÂàëøýþÃÂþôýÃÂùû ôûàHTML úþô, úþÃÂþÃÂÃÂù ÃÂÿõÃÂøðûÃÂýÃÂü þñÃÂð÷þü øýÃÂõÃÂÿÃÂõÃÂøÃÂÃÂõÃÂÃÂàÃÂõÃÂòõÃÂþü ø üþöõàñÃÂÃÂàøÃÂÿþûÃÂ÷þòðý ôûàòÃÂÃÂðòúø ÃÂð÷ûøÃÂýÃÂÃÂ
ôðýýÃÂÃÂ
. ÃÂÃÂÃÂàýõÃÂúþûÃÂúþ ÃÂøÿþò ÃÂðúøÃÂ
òÃÂÃÂðòþú. | |
− | * {{oncolor||red|<%@...%>}} | + | * {{oncolor||red|<%@...%>}} â þñþ÷ýðÃÂðõàÃÂÿõÃÂøðûÃÂýÃÂàòÃÂÃÂðòúÃÂ, úþÃÂþÃÂðàþÿÃÂõôõûÃÂõàÿðÃÂðüõÃÂÃÂàÃÂÃÂÃÂðýøÃÂÃÂ, ò ýðÃÂõü ÃÂûÃÂÃÂðõ â {{oncolor||red|ContentType}}. ÃÂþöýþ ÷ðôðòðÃÂÃÂ, ýðÿÃÂøüõÃÂ, ÃÂ÷ÃÂú, ýð úþÃÂþÃÂþü ýðÿøÃÂðýð ÃÂÃÂÃÂðýøÃÂð. ÃÂý öõ øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂàôûàÃÂõúÃÂøù {{oncolor||red|import}} (ÃÂü. '''view.jsp''' ýøöõ). |
− | * {{oncolor||red|<%=...%>}} | + | * {{oncolor||red|<%=...%>}} â ÃÂÃÂþ ÿÃÂþÃÂÃÂþù òÃÂòþô ÿõÃÂõüõýýþù. ÃÂõùÃÂÃÂòøõ òÃÂÃÂðòúø {{oncolor||red|<%=ÃÂÃÂþ-ýøñÃÂôÃÂ%>}} ðýðûþóøÃÂýþ òÃÂ÷þòà{{oncolor||red|request.getWriter().write(ÃÂÃÂþ-ýøñÃÂôÃÂ)}}. |
− | * {{oncolor||red|<%...%>}} | + | * {{oncolor||red|<%...%>}} â ÃÂðüÃÂù þñÃÂøù òðÃÂøðýàòÃÂÃÂðòúø, òýÃÂÃÂÃÂø üþöõàñÃÂÃÂàûÃÂñþù úþô. àýðÃÂõü ÃÂûÃÂÃÂðõ, ýð Java. |
− | '''index.jsp''' | + | '''index.jsp''' â ÿÃÂþÃÂÃÂþù ÃÂðùû, ÿþÃÂüþÃÂÃÂøü ýð ýõÃÂÃÂþ ñþûõõ ÃÂûþöýþõ. ÃÂðÿÃÂøüõÃÂ, '''view.jsp''' '''(ÃÂøÃÂÃÂøýó 6)'''. |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 6. view.jsp}}''' |
<nowiki> | <nowiki> | ||
Строка 224: | Строка 268: | ||
<%@ page import="java.util.*" %> | <%@ page import="java.util.*" %> | ||
<html> | <html> | ||
− | <head><title> | + | <head><title>ÃÂôÃÂõÃÂýðàúýøóð</title></head> |
− | <body><h1> | + | <body><h1>ÃÂôÃÂõÃÂýðàúýøóð, ÃÂÿøÃÂþú úþýÃÂðúÃÂþò</h1> |
− | <a href="<%=request.getContextPath()%>"> | + | <a href="<%=request.getContextPath()%>">ÃÂð óûðòýÃÂÃÂ</a><br/> |
<span style="color: green;"><%=request.getAttribute("message")%></span> | <span style="color: green;"><%=request.getAttribute("message")%></span> | ||
<table border="1"> | <table border="1"> | ||
− | <tr><td width="100"> | + | <tr><td width="100">ÃÂüÃÂ</td><td width="100">ÃÂþüõÃÂ</td><td width="100">ÃÂþüüõýÃÂðÃÂøù</td><td> - </td></tr> |
<% Map numbers = (Map) request.getAttribute("numbers"); | <% Map numbers = (Map) request.getAttribute("numbers"); | ||
Map comments = (Map) request.getAttribute("comments"); | Map comments = (Map) request.getAttribute("comments"); | ||
Строка 241: | Строка 285: | ||
<td class="comment"><%=comment%></td> | <td class="comment"><%=comment%></td> | ||
<td class="name"> | <td class="name"> | ||
− | <a href="<%=request.getContextPath()%>/remove?number=<%=number%>"> | + | <a href="<%=request.getContextPath()%>/remove?number=<%=number%>">ãôðûøÃÂÃÂ</a> |
− | <a href="<%=request.getContextPath()%>/edit?number=<%=number%>"> | + | <a href="<%=request.getContextPath()%>/edit?number=<%=number%>">àõôðúÃÂøÃÂþòðÃÂÃÂ</a> |
</td> | </td> | ||
</tr> | </tr> | ||
Строка 251: | Строка 295: | ||
</nowiki> | </nowiki> | ||
− | + | ÃÂðú üþöýþ ÷ðüõÃÂøÃÂÃÂ, ÷ôõÃÂàõÃÂÃÂàø øüÿþÃÂà(þ ÃÂõü àóþòþÃÂøû ÃÂÃÂÃÂàòÃÂÃÂõ), ø òÃÂÃÂðòúð Java-úþôð. ÃÂðýýÃÂù ÃÂðùû þÃÂûøÃÂýþ ÿþúð÷ÃÂòðõÃÂ, úðú, ýðÿÃÂøüõà(ýõ ÃÂðüÃÂù ûÃÂÃÂÃÂøù ÃÂÿþÃÂþñ, úþýõÃÂýþ), ÃÂôõûðÃÂàòÃÂòþô ò ÃÂøúûõ. | |
− | === | + | === àúðú ÃÂÃÂþ þñÃÂðñðÃÂÃÂòðõÃÂÃÂÃÂ-ÃÂþ? === |
− | + | ÃÂÃÂÃÂõÃÂÃÂòõýýþ, ø üõÃÂþôà{{oncolor||red|handle}}... ÿþÃÂûõ ÃÂðúþóþ ø÷üõýõýøàÃÂÃÂðûø ôÃÂÃÂóøüø. ÃÂõÃÂàòÃÂòþô HTML-úþôð øÃÂÃÂõ÷, þÃÂÃÂðûðÃÂàÿþôóþÃÂþòúð ôðýýÃÂÃÂ
, ø òÃÂ÷þò üõÃÂþôð {{oncolor||red|outputPage}}. ÃÂþÃÂ, ýðÿÃÂøüõÃÂ, üõÃÂþô {{oncolor||red|handleEdit(...)}} '''(ÃÂøÃÂÃÂøýó 7)''': | |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 7. ÃÂõÃÂþô handleEdit, þñÃÂðñþÃÂúð ÃÂõôðúÃÂøÃÂþòðýøà÷ðÿøÃÂø}}''' |
if (aRequest.getParameter("number") == null) { | if (aRequest.getParameter("number") == null) { | ||
_addressBook.removeContactByNumber(aRequest.getParameter("number")); | _addressBook.removeContactByNumber(aRequest.getParameter("number")); | ||
− | aRequest.setAttribute("message", " | + | aRequest.setAttribute("message", "ÃÂõ þÿÃÂõôõûõýþ, ÃÂÃÂþ ÃÂõôðúÃÂøÃÂþòðÃÂÃÂ"); |
handleView(aRequest, aResponse); | handleView(aRequest, aResponse); | ||
} else if (aRequest.getParameter("edited") != null) { | } else if (aRequest.getParameter("edited") != null) { | ||
Строка 268: | Строка 312: | ||
aRequest.getParameter("number"), | aRequest.getParameter("number"), | ||
aRequest.getParameter("comment")); | aRequest.getParameter("comment")); | ||
− | aRequest.setAttribute("message", " | + | aRequest.setAttribute("message", "ÃÂþýÃÂðúà\"" + |
− | aRequest.getParameter("name") + "\" | + | aRequest.getParameter("name") + "\" þÃÂÃÂõôðúÃÂøÃÂþòðý"); |
handleView(aRequest, aResponse); | handleView(aRequest, aResponse); | ||
} else { | } else { | ||
Строка 280: | Строка 324: | ||
} | } | ||
− | + | ÃÂÃÂÃÂðûÃÂýÃÂõ üõÃÂþôàüõýÃÂÃÂÃÂÃÂàðýðûþóøÃÂýþ â øÃÂ
[[Media:Archive.tar.bz2âÂÂ|ÿþûýÃÂù úþô]] üþöýþ ýðùÃÂø ýð ôøÃÂúõ. | |
− | === | + | === àúðú òÃÂõ ÃÂÃÂþ òÃÂÃÂðòøÃÂàò Tomcat? === |
− | + | âõÿõÃÂààýðàõÃÂÃÂÃÂ: | |
− | * | + | * ÃÂûðÃÂÃÂà{{oncolor||red|Contact}}, {{oncolor||red|AddressBook}}, {{oncolor||red|AddressBookServlet}}. |
− | * | + | * äðùû '''web.xml'''. |
− | * | + | * ÃÂðÃÂðûþó '''jsps''' àÃÂðùûðüø '''edit.jsp''', '''index.jsp''', '''view.jsp'''. |
− | + | ÃÂûàÃÂþóþ, ÃÂÃÂþñàTomcat ÿþýÃÂû, ÃÂÃÂþ õüàôðûø ÿþûýþÃÂõýýþõ ÿÃÂøûþöõýøõ, ýÃÂöýþ òÃÂÿþûýøÃÂàòÃÂõóþ ÃÂÃÂø ÃÂðóð: | |
− | * | + | * áúþüÿøûøÃÂþòðÃÂàòÃÂõ, ÃÂÃÂþ úþüÿøûøÃÂÃÂõÃÂÃÂÃÂ, ø ÃÂþ÷ôðÃÂàÿÃÂðòøûÃÂýÃÂàøõÃÂðÃÂÃÂ
øàÃÂðùûþò ø úðÃÂðûþóþò, úþÃÂþÃÂðàÿÃÂõôÃÂÃÂðòûõýð '''ýð ÃÂøÃÂ. 2'''. |
− | * | + | * áþ÷ôðÃÂàÃÂÿõÃÂøðûÃÂýÃÂù ÃÂðùû-þÿøÃÂðýøõ ðÃÂÃÂ
øòð (ëüðýøÃÂõÃÂÃÂû). |
− | * | + | * ÃÂððÃÂÃÂ
øòøÃÂþòðÃÂàÃÂþ÷ôðýýÃÂàÃÂÃÂÃÂÃÂúÃÂÃÂÃÂàÿÃÂø ÿþüþÃÂø ÃÂÃÂøûøÃÂà''jar'', òÃÂ
þôÃÂÃÂõù ò úþüÿûõúàJDK. |
− | + | áúþüÿøûøÃÂÃÂõü ÃÂðùûÃÂ. âÃÂàýøÃÂõóþ ýþòþóþ ýõ ÿþÃÂòøûþÃÂÃÂ, ÃÂð÷òõ ÃÂÃÂþ ø÷üõýøûðÃÂàÃÂðüð úþüðýôð (þñÃÂðÃÂøÃÂõ òýøüðýøõ ýð úûÃÂà{{oncolor||red|-cp}}, ÷ðôðÃÂÃÂøù ñøñûøþÃÂõúø {{oncolor||red|classpath}}): | |
cd ~/Programming/AddressBook/src | cd ~/Programming/AddressBook/src | ||
javac -encoding utf-8 -cp ~/bin/tomcat/common/lib/servlet-api.jar -d ../build/WEB-INF/classes/ *.java | javac -encoding utf-8 -cp ~/bin/tomcat/common/lib/servlet-api.jar -d ../build/WEB-INF/classes/ *.java | ||
− | + | ÃÂõÃÂõÃÂ
þôøü ú ÃÂþ÷ôðýøàüðýøÃÂõÃÂÃÂð. ÃÂý ôþûöõý ýð÷ÃÂòðÃÂÃÂÃÂà'''MANIFEST.MF''' ø ÃÂðÃÂÿþûðóðÃÂÃÂÃÂàò úðÃÂðûþóõ '''META-INF'''. àÃÂÃÂðÃÂÃÂÃÂÃÂ, ÷ð ÃÂÃÂøü ÃÂûõôøàÃÂðü '''jar''', ÿþÃÂÃÂþüàýðü ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂþ ÃÂþÃÂ
ÃÂðýøÃÂàóôõ-ÃÂþ ÃÂðùû ø ÃÂúð÷ðÃÂàõóþ '''jar''''àúðú üðýøÃÂõÃÂÃÂ. àýðÃÂõü ÃÂûÃÂÃÂðõ þý ÿÃÂõôõûÃÂýþ ÿÃÂþÃÂàø ýõ ÃÂþôõÃÂöøàøýÃÂõÃÂõÃÂýþù øýÃÂþÃÂüðÃÂøø, ýþ ò ÿÃÂøýÃÂøÿõ ÷ôõÃÂàüþóÃÂàÃÂðÃÂÿþûðóðÃÂÃÂÃÂàòÃÂÃÂúøõ ýðÃÂÃÂÃÂþùúø ôûà÷ðÿÃÂÃÂúð òðÃÂõóþ ÿÃÂøûþöõýøÃÂ. ÃÂþàõóþ ÃÂõúÃÂà'''(ÃÂøÃÂÃÂøýó 8)''': | |
− | '''{{oncolor||red| | + | '''{{oncolor||red|ÃÂøÃÂÃÂøýó 8. ÃÂðýøÃÂõÃÂàôûàwar-ÃÂðùûð}}''' |
Manifest-Version: 1.0 | Manifest-Version: 1.0 | ||
Created-By: Hands of programmer | Created-By: Hands of programmer | ||
− | + | âõÿõÃÂàÃÂþñõÃÂõü òÃÂõ ò {{oncolor||red|war}} (Web Archive). ÃÂðýøÃÂõÃÂàôûàÿÃÂøòõôõýýþù ýøöõ úþüðýôàôþûöõý ñÃÂÃÂàýð÷òðý '''MANIFEST.MF''' ø ÃÂðÃÂÿþûðóðÃÂÃÂÃÂàÃÂÃÂôþü àúðÃÂðûþóþü '''build'''. àõ÷ÃÂûÃÂÃÂøÃÂÃÂÃÂÃÂøù ðÃÂÃÂ
øò ýð÷ÃÂòðõÃÂÃÂà'''address.war''' ø ÃÂðÃÂÿþûðóðõÃÂÃÂàÃÂðü öõ, ÃÂÃÂôþü àüðýøÃÂõÃÂÃÂþü. | |
jar -cfm ../address.war ../MANIFEST.MF * | jar -cfm ../address.war ../MANIFEST.MF * | ||
− | + | àÃÂõùÃÂðàýðÃÂÃÂÃÂÿðõàÃÂðüÃÂù òþûÃÂõñýÃÂù üþüõýÃÂ! ÃÂþ÷ÃÂüøÃÂõ '''address.war''' ø ÿþûþöøÃÂõ õóþ ò úðÃÂðûþó webapps Tomcat'ð. ÃÂþôþöôøÃÂõ ýõÃÂúþûÃÂúþ ÃÂõúÃÂýô. ãòøôõò ýþòþõ ÿÃÂøûþöõýøõ, Tomcat ÃÂð÷òõÃÂýõàõóþ (ÿþÃÂòûÃÂõÃÂÃÂàúðÃÂðûþó àøüõýõü òðÃÂõóþ war'ð) ø ÿþôúûÃÂÃÂøàú ÃÂøÃÂÃÂõüõ. ÃÂþÃÂûõ ÃÂÃÂþóþ üþöýþ ÿÃÂþÃÂÃÂþ ÷ðùÃÂø ò ñÃÂðÃÂ÷õàø ýðñÃÂðÃÂÃÂ: | |
http://localhost:8080/address/ | http://localhost:8080/address/ | ||
− | + | ÃÂÃÂðûÃÂ, ÿþûÃÂÃÂøÃÂõ òðÃÂõ ÿÃÂøûþöõýøõ. | |
− | === | + | === àÃÂÃÂþ ÃÂõÿõÃÂÃÂ? === |
− | + | àÃÂõÿõÃÂàüþöýþ üõýÃÂÃÂàJSP-ÃÂðùûàëýð ûõÃÂÃÂû ò ÃÂðÃÂÿðúþòðýýþü úðÃÂðûþóõ '''webapps/address/jsps'''. ÃÂÃÂø ÃÂÃÂþü ñÃÂôõàðòÃÂþüðÃÂøÃÂõÃÂúø ÿÃÂþøÃÂÃÂ
þôøÃÂàýõÃÂúþûÃÂúþ ôõùÃÂÃÂòøù, ò ÃÂõ÷ÃÂûÃÂÃÂðÃÂõ úþÃÂþÃÂÃÂÃÂ
ÃÂðùûàÿþôÃÂ
òðÃÂÃÂÃÂÃÂàÿÃÂøûþöõýøõü. âðú üõýÃÂõÃÂÃÂàôø÷ðùý ñõ÷ ÿõÃÂõúþüÿøûÃÂÃÂøø, ñõ÷ ÃÂõÃÂÃÂðÃÂÃÂð ÃÂõÃÂòõÃÂýþóþ ÿÃÂøûþöõýøÃÂ, úðú ÃÂÃÂþ àýðàñÃÂûþ ôþ ÃÂøÃÂ
ÿþÃÂ. | |
− | + | ï ÃÂÃÂøÃÂðÃÂ, ÃÂÃÂþ ýð ôðýýþü ÃÂÃÂðÿõ ÿÃÂøûþöõýøõ ëÃÂôÃÂõÃÂýðàúýøóðû ÃÂðñþÃÂðõàÃÂ
þÃÂþÃÂþ. ÃÂýþ òÃÂÿþûýÃÂõàÃÂòþø ýõÃÂûþöýÃÂõ ÃÂÃÂýúÃÂøø ø ÃÂüõõàø÷üõýÃÂÃÂÃÂÃÂàëýð ûõÃÂÃÂû ÿþ ÷ðÿÃÂþÃÂàÿþûÃÂ÷þòðÃÂõûÃÂ. ÃÂýþ ÿÃÂþÃÂÃÂþõ â ø ÃÂÃÂþ ÃÂÃÂÃÂàûø ýõ ÃÂðüþõ óûðòýþõ. ÃÂþ õÃÂÃÂàõÃÂõ ôþÃÂÃÂðÃÂþÃÂýþ ðÃÂÿõúÃÂþò, þ úþÃÂþÃÂÃÂÃÂ
ÃÂÃÂþøà÷ýðÃÂàÿÃÂø ÃÂð÷ÃÂðñþÃÂúõ ñþûõõ ÃÂûþöýÃÂÃÂ
øýÃÂõÃÂýõÃÂ-ÿÃÂøûþöõýøù. ÃÂàÃÂðÃÂÃÂüþÃÂÃÂøü øÃÂ
ò ÃÂûõôÃÂÃÂÃÂøÃÂ
ÃÂÃÂðÃÂÃÂÃÂÃÂ
ôðýýþù ÃÂõÃÂøø. [http://www.linuxformat.ru LXF] |
Версия 09:08, 28 мая 2009
|
|
|
[http://s1.shard.jp/galeach/new98.html asian menus ] url [http://s1.shard.jp/olharder/autologous-cell.html colorado's transition from no-fault to tort auto insurance ] [http://s1.shard.jp/losaul/hsbc-asset-management.html book designers australia ] african elephant masks [http://s1.shard.jp/bireba/kaspersky-antivirus.html mac os x antivirus download ] [http://s1.shard.jp/frhorton/ufkvsduv1.html west african fish recipes ] [http://s1.shard.jp/frhorton/3q938n1mz.html edgars stores south africa ] [http://s1.shard.jp/galeach/new76.html asian ts.commembers http ] [http://s1.shard.jp/galeach/new41.html asian buffet indulge ] [http://s1.shard.jp/bireba/antivirusreviews.html antivirus trendmicro ] [http://s1.shard.jp/olharder/auto-remer.html car accident claim auto cheap insurance ] [http://s1.shard.jp/frhorton/vuku1m6uz.html african american life during the great deppression ] [http://s1.shard.jp/olharder/best-way-auto-care.html rhode island automobile insurance plan ] south african war medals anyware antivirus [http://s1.shard.jp/bireba/antivirus-avg7.html symantec antivirus client removal tool ] [http://s1.shard.jp/frhorton/b9vqclfhc.html tefsa south africa ] [http://s1.shard.jp/losaul/2006-australia.html liquor licensing act south australia ] [http://s1.shard.jp/bireba/panda-titanium-antivirus.html panda titanium antivirus 2005 reviews ] [http://s1.shard.jp/frhorton/bq5czt3ax.html africa marine world usa ] [http://s1.shard.jp/bireba/mobile-antivirus.html antivirus w32 rontokbro ] [http://s1.shard.jp/galeach/new44.html utech asia 2005 ] [http://s1.shard.jp/galeach/new153.html de fantasia jardin ] [http://s1.shard.jp/losaul/06-australia.html bunnings australia ] [http://s1.shard.jp/olharder/rockies-auto-colorado.html renta de automobile ] doug robb hoobastank asian [http://s1.shard.jp/losaul/alzeihmers-australia.html 21 australia century estate real ] [http://s1.shard.jp/galeach/new88.html southern asia bible college bangalore ] [http://s1.shard.jp/bireba/antivirus-2004.html titanium antivirus and truprevent compusa display ] domain [http://s1.shard.jp/frhorton/91rryr9x4.html south african cricket tickets ] [http://s1.shard.jp/galeach/new178.html international calling card to africa asia ] [http://s1.shard.jp/losaul/australian-bull.html ibm notebook australia ] [http://s1.shard.jp/olharder/luggage-rack-automobile.html prays auto ] [http://s1.shard.jp/galeach/new84.html asian ladyboy ladyboys ] [http://s1.shard.jp/olharder/automobile-promotion.html automatically format drive boot disk ] [http://s1.shard.jp/bireba/northon-antivirus.html nortun antivirus ] [http://s1.shard.jp/bireba/panda-titanium.html avg antivirus system download ] [http://s1.shard.jp/bireba/alertaantivirus.html 2006 keygen pro v2.0.205.1 winantivirus ] [http://s1.shard.jp/olharder/accessory-automotive.html autocourse.com ] [http://s1.shard.jp/galeach/new33.html what is hip dysplasia in dogs ] [http://s1.shard.jp/galeach/new51.html mr. chews asian beaver mika ] [http://s1.shard.jp/losaul/beds-online-australia.html australia biggest looser chanel ten ] [http://s1.shard.jp/bireba/antivirus-stop.html types of antivirus softwares ] [http://s1.shard.jp/losaul/quiksilver-pro.html electoral role australia search ] [http://s1.shard.jp/bireba/winantivirus-pro.html norton antivirus 2005 cracked ] [http://s1.shard.jp/losaul/australia-transcriber.html good food guide melbourne australia ] [http://s1.shard.jp/frhorton/upga9mswa.html africa city south sun things ] australia importing [http://s1.shard.jp/losaul/picture-of-food.html cpi paper australia ] [http://s1.shard.jp/losaul/exchange-rate-australian.html hedge funds australia ] [http://s1.shard.jp/galeach/new100.html ductular hepatic hypoplasia syndromatic ] [http://s1.shard.jp/galeach/new170.html att calling card international prepaid asia ] [http://s1.shard.jp/bireba/download-norton.html uninstall norton antivirus corporate edition ] [http://s1.shard.jp/olharder/auto-escort-ford.html autobahn vw parts ] [http://s1.shard.jp/losaul/weight-loss-medication.html aboriginal australian picture ] [http://s1.shard.jp/galeach/new113.html asian babe cam hot web ] [http://s1.shard.jp/galeach/new57.html asian rainforests ] [http://s1.shard.jp/olharder/automotive-tool.html autotrader.co.ukwww. ] link [http://s1.shard.jp/losaul/murrays-buses.html australian manufacturing inc. ] [http://s1.shard.jp/olharder/automoveis-bmw.html auto cad viz ] [http://s1.shard.jp/bireba/download-symantec.html norton antivirus update crack ] elephants african link [http://s1.shard.jp/galeach/new186.html asian fever 12 ] [http://s1.shard.jp/losaul/australia-bus.html australian open competitors ] [http://s1.shard.jp/galeach/new47.html booking online airasia ] [http://s1.shard.jp/galeach/new184.html anastasia - bartok ] [http://s1.shard.jp/losaul/compare-flights.html australia craft supply ] download kaspersky antivirus file server version 5 [http://s1.shard.jp/olharder/jl-french-automotive.html a language for automation ] [http://s1.shard.jp/olharder/kurt-cobain-autograph.html lab automation career job ] [http://s1.shard.jp/losaul/06-australia.html physiotherapist jobs australia ] [http://s1.shard.jp/olharder/sunnyside-auto.html autoverhuur en language language malaga nl nl site ] [http://s1.shard.jp/olharder/automobile-dealer.html auto accident personal injury claims ] [http://s1.shard.jp/frhorton/77murrpay.html joberg south africa ] url [http://s1.shard.jp/bireba/quickheal-antivirus.html mdaemon antivirus ] [http://s1.shard.jp/olharder/autonomy-principal.html holzvergaser auto ] [http://s1.shard.jp/bireba/download-free.html grisoft antivirus ] [http://s1.shard.jp/galeach/new60.html asia holiday travel ] page [http://s1.shard.jp/losaul/emmigrating-australia.html state library of south australia ] [http://s1.shard.jp/frhorton/1euh2vemn.html timbavati south africa ] [http://s1.shard.jp/galeach/new51.html asian beaver mr.chews ] [http://s1.shard.jp/frhorton/9rxlvcl6n.html african men pics ] [http://s1.shard.jp/frhorton/lyfh4c7mt.html african american body image in woman ] webmap car importers australia [http://s1.shard.jp/bireba/microworld-antivirus.html antivirus software for server 2003 ] [http://s1.shard.jp/olharder/subasta-de-autos.html literary autobiography 1994 infant prodigy ] [http://s1.shard.jp/frhorton/vjlche4gq.html africa against aids current fight in news ] antivirus stop sign [http://s1.shard.jp/losaul/australian-landrover.html gun australia ] [http://s1.shard.jp/frhorton/xntk9qgnd.html medical association of south africa ] [http://s1.shard.jp/losaul/quiksilver-pro.html electoral role australia search ] [http://s1.shard.jp/losaul/ralph-lauren.html sydney australia phone directory ] Шаблон:æøúû/Java EE
âõûõÃÂþýýðàúýøóð: ÿõÃÂõàþô ýð JSP
çÃÂáâì 2 ÃÂÃÂÃÂÃÂõÃÂðÃÂàÿþ þôõöúõ â ø ÃÂþûÃÂÃÂþù ÃÂþÃÂàýõ ñÃÂû ÃÂøûÃÂýþ òÿõÃÂðÃÂûõý ÃÂþ÷ôðýýþù ýðüø ò ÿÃÂþÃÂûÃÂù ÃÂð÷ ðôÃÂõÃÂýþù úýøóþù. ÃÂûõúÃÂðýôàÃÂðñðõò øÃÂÿÃÂðòûÃÂõà÷ðüõÃÂõýýÃÂõ ýõôþÃÂõÃÂÃÂ.
àÿÃÂþÃÂûÃÂù ÃÂð÷ üàÃÂþ÷ôðûø ÿÃÂþÃÂÃÂõùÃÂÃÂàÃÂûõúÃÂÃÂþýýÃÂà÷ðÿøÃÂýÃÂàúýøöúÃÂ. ÃÂýð ÃÂðñþÃÂðõàò ñÃÂðÃÂ÷õÃÂõ ø ÿþúð÷ÃÂòðõàýõÃÂúþûÃÂúþ ÿÃÂþÃÂÃÂÃÂàÃÂÃÂÃÂðýøÃÂõú, ýð úþÃÂþÃÂÃÂàüþöýþ ÿÃÂþÃÂüþÃÂÃÂõÃÂàÃÂÿøÃÂþú úþýÃÂðúÃÂþò, ôþñðòøÃÂàýþòÃÂù úþýÃÂðúÃÂ, ÃÂôðûøÃÂàõóþ øûø þÃÂÃÂõôðúÃÂøÃÂþòðÃÂÃÂ. àÃÂõùÃÂðàôðòðùÃÂõ ÿþÿÃÂþñÃÂõü ÃÂôõûðÃÂàòÃÂõ ÃÂÃÂþ ñþûõõ ÿÃÂðòøûÃÂýþ.
ÃÂþÃÂõüàñÃÂûþ ÿûþàþ?
ÃÂõùÃÂÃÂòøÃÂõûÃÂýþ, ÿþÃÂõüÃÂ? àðñþÃÂðõÃÂ, ø àþÃÂþÃÂþ. ÃÂþÃÂÃÂðÃÂþÃÂýþ ñÃÂÃÂÃÂÃÂþ ø ýõ ÃÂûøÃÂúþü ÃÂûþöýþ. ÃÂþ òôÃÂÃÂó ÷ðàþÃÂõÃÂÃÂàÿþüõýÃÂÃÂàôø÷ðùý ÃÂÃÂÃÂðýøÃÂõú? à÷ðàþÃÂõÃÂÃÂàÃÂõÃÂõ÷ ôõÃÂÃÂÃÂàüøýÃÂàÃÂðñþÃÂÃÂ. ÃÂûø ÿþÃÂûõ ÃÂþóþ, úðú ÃÂÃÂÃÂðýøÃÂúàÿþÃÂüþÃÂÃÂøàýðÃÂðûÃÂýøú.
çÃÂþñàÃÂôõûðÃÂàÃÂÃÂþ, üþöýþ ø÷üõýøÃÂàúþô ÿÃÂþõúÃÂð, ÿþÃÂþü ÿõÃÂõúþüÿøûøÃÂþòðÃÂàõóþ, þÃÂÃÂðýþòøÃÂàÃÂõÃÂòõà(ÃÂ? ÃÂÃÂþ-ÃÂþ ÃÂðñþÃÂðû? ÃÂ÷òøýøÃÂõ...), ÃÂÃÂÃÂðýþòøÃÂàýþòÃÂù úþô ø ÿþòÃÂþÃÂýþ ÷ðÿÃÂÃÂÃÂøÃÂàÃÂõÃÂòõÃÂ. ÃÂõÃÂþô, üÃÂóúþ óþòþÃÂÃÂ, ýõÃÂôþñýÃÂù. àüþöýþ ø÷üõýøÃÂàÃÂðü ÿÃÂþõúàÃÂðú, ÃÂÃÂþñàòÃÂÿþûýõýøõ ÃÂðúøàÿþöõûðýøù ýõ ÃÂÃÂõñþòðûþ ÃÂÃÂþûàÃÂûþöýÃÂàôõùÃÂÃÂòøù. ÃÂÃÂþÃÂþù ÿÃÂÃÂà÷þòõÃÂÃÂàÃÂõÃÂðúÃÂþÃÂøýóþü ø óþÃÂð÷ôþ ñþûõõ úþÃÂÃÂõúÃÂõý. ÃÂÃÂûø ÃÂð÷ôõûøÃÂàôø÷ðùý ø ûþóøúàÃÂðñþÃÂàÿÃÂøûþöõýøà(ñø÷ýõÃÂ-ûþóøúÃÂ), ÃÂþ ò ôðûÃÂýõùÃÂõü üþöýþ ñÃÂôõÃÂ, ýðÿÃÂøüõÃÂ, ÃÂð÷ôõûøÃÂàø ÃÂðñþÃÂàÿþ øàÿþôôõÃÂöðýøÃÂ. Ã¥þÃÂþÃÂøù ÿÃÂþóÃÂðüüøÃÂàýõ òÃÂõóôð ÃÂþ÷ôðõààþÃÂþÃÂøõ ÿþûÃÂ÷þòðÃÂõûÃÂÃÂúøõ øýÃÂõÃÂÃÂõùÃÂÃÂ, ÿþÃÂÃÂþüàôðýýÃÂù ðÃÂÿõúàÃÂþöõ òðöõý.
ÃÂðú ÃÂôõûðÃÂààþÃÂþÃÂþ?
ÃÂÃÂ, òúÃÂðÃÂÃÂõ ÃÂöõ ÿþýÃÂÃÂýþ. ÃÂÃÂöýþ òÃÂýõÃÂÃÂø ò þÃÂôõûÃÂýÃÂõ ÃÂðùûàÃÂàÃÂðÃÂÃÂÃÂ, úþÃÂþÃÂðàüõýÃÂõÃÂÃÂàÃÂðÃÂÃÂþ (ò ýðÃÂõü ÃÂûÃÂÃÂðõ, ÃÂÃÂþ øýÃÂõÃÂÃÂõùÃÂ) ø úðú-ÃÂþ ÿþôúûÃÂÃÂøÃÂàÃÂÃÂø ÃÂðùûàø÷ ýðÃÂõù ÿÃÂþóÃÂðüüÃÂ. ÃÂûÃÂÃÂ, öõûðÃÂõûÃÂýþ ÃÂôõûðÃÂàÃÂÃÂþ ÃÂðú, ÃÂÃÂþñàÃÂþÃÂüðàÃÂðùûþò ëôø÷ðùýðû ñÃÂû ÃÂÃÂðýôðÃÂÃÂýÃÂü, ÃÂÃÂþñàúðöôÃÂù ÃÂð÷ ýõ ÿõÃÂõÃÂÃÂøòðÃÂÃÂÃÂÃÂ.
àõÃÂõýøù ôûàôðýýþù ÿÃÂþñûõüàÃÂÃÂÃÂõÃÂÃÂòÃÂõàüýþöõÃÂÃÂòþ. àðÃÂÃÂüþÃÂÃÂøü ÃÂðüÃÂõ ÃÂðÃÂÿÃÂþÃÂÃÂÃÂðýõýýÃÂõ:
- èðñûþýÃÂ. ÃÂôýð ø÷ ÃÂðüÃÂàÃÂðÃÂÿÃÂþÃÂÃÂÃÂðýõýýÃÂàñøñûøþÃÂõú ÃÂðñþÃÂààÃÂðñûþýðüø â Velocity. ÃÂÃÂø øÃÂÿþûÃÂ÷þòðýøø ÃÂðñûþýýÃÂàôòøöúþò üþöýþ ôþñðòûÃÂÃÂàò ÃÂõúÃÂàÃÂÿõÃÂøðûÃÂýÃÂõ òÃÂÃÂðòúø, úþÃÂþÃÂÃÂõ óþòþÃÂÃÂÃÂ: ëâÃÂàòÃÂÃÂðòøÃÂà÷ýðÃÂõýøõ ÿõÃÂõüõýýþù Nameû. ÃÂýþóôð üþöýþ ôõûðÃÂàñþûõõ ÃÂûþöýÃÂõ þÿõÃÂðÃÂøø (òÃÂÃÂðòúð ÿþôÃÂðñûþýþò, òÃÂÃÂøÃÂûõýøÃÂ, ÃÂÃÂûþòýÃÂõ òÃÂÃÂðòúø).
- JSP (Java Server Pages). ÃÂþ òÃÂõüõýø ÿþÃÂòûõýøÃÂ, ÿþöðûÃÂù, ÿõÃÂòðàÃÂõàýþûþóøàôûàþÃÂôõûõýøàôø÷ðùýð þàñø÷ýõÃÂ-ûþóøúø. ÃÂþ àõõ ÿþÃÂÃÂðòøû òÃÂþÃÂþù, ÃÂðú úðú þýð ÃÂûþöýõõ, ÃÂõü ÿÃÂþÃÂÃÂþ ÃÂðñûþýýðàñøñûøþÃÂõúð. JSP ÿþ÷òþûÃÂõàòýõôÃÂøÃÂàúþô ýð (ÿþ ÷ðôÃÂüúõ) ûÃÂñþü ÃÂ÷ÃÂúõ ÿÃÂþóÃÂðüüøÃÂþòðýøàòýÃÂÃÂÃÂàÃÂÿõÃÂøðûÃÂýÃÂü þñÃÂð÷þü ÃÂþ÷ôðýýþù ÃÂÃÂÃÂðýøÃÂúø. ÃÂÿÃÂþÃÂõü, þñÃÂÃÂýþ øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂàJava. âõþÃÂõÃÂøÃÂõÃÂúø, üþöýþ ýðÿøÃÂðÃÂàÃÂõÃÂòõÃÂýþõ ÿÃÂøûþöõýøõ, øÃÂÿþûÃÂ÷ÃÂàøÃÂúûÃÂÃÂøÃÂõûÃÂýþ JSP. ÃÂÃÂþàÿþôàþô ÿþàþö ýð PHP, àÃÂõü þÃÂûøÃÂøõü, ÃÂÃÂþ JSP-ÃÂÃÂÃÂðýøÃÂàâ ÃÂÃÂþ ÿþûýþÃÂõýýÃÂõ ÃÂõÃÂòûõÃÂÃÂ, þýø úþüÿøûøÃÂÃÂÃÂÃÂÃÂàÿÃÂø þñýþòûõýøø øÃÂàþôýþóþ ÃÂõúÃÂÃÂð ø þñÃÂðñðÃÂÃÂòðÃÂÃÂÃÂàúðú ÃÂðúþòÃÂõ.
- JSF (Java Server Faces). àýõúþÃÂþÃÂþü ÃÂþôõ ÃÂÃÂð ÃÂõàýþûþóøàþñÃÂõôøýÃÂõàÿþôàþôÃÂ, úþÃÂþÃÂÃÂõ øÃÂÿþûÃÂ÷ÃÂÃÂÃÂÃÂàÿÃÂø ÃÂþ÷ôðýøø ëþñÃÂÃÂýÃÂàû ø ëÃÂõÃÂõòÃÂàû ÿÃÂþóÃÂðüü. ÃÂýÃÂõÃÂÃÂõùà(úðú ôø÷ðùý øýÃÂõÃÂÃÂõùÃÂð, ÃÂðú ø õóþ ûþóøúð) ÿÃÂþóÃÂðüüàþÿøÃÂÃÂòðõÃÂÃÂàÃÂÿõÃÂøðûÃÂýÃÂü þñÃÂð÷þü, ð ÿþÃÂûõ ÃÂÃÂþóþ ÿøÃÂÃÂÃÂÃÂàJSP-ÃÂÃÂÃÂðýøÃÂúø, ò úþÃÂþÃÂÃÂàÃÂúð÷ÃÂòðõÃÂÃÂàëÃÂÃÂàòÃÂÃÂðòøÃÂàÃÂðñûøÃÂààøüõýõü ÃÂðúøü-ÃÂþû. JSF þñÃÂðñðÃÂÃÂòðõàÃÂÃÂø ÃÂÿõÃÂòÃÂÃÂðòúø ø ëÃÂøÃÂÃÂõÃÂû ÃÂÃÂýúÃÂøþýðûÃÂýÃÂõ ÃÂûõüõýÃÂàøýÃÂõÃÂÃÂõùÃÂð (þñÃÂðñðÃÂÃÂòðàÃÂþñÃÂÃÂøàþàýøàø ÃÂðú ôðûõõ), ÿþ÷òþûÃÂàôø÷ðùýõÃÂàÃÂþÃÂÃÂõôþÃÂþÃÂøÃÂÃÂÃÂàýð þÃÂÃÂðûÃÂýþü.
- Google Web Toolkit. ÃÂõ üþóàýõ þÃÂÃÂðýþòøÃÂÃÂÃÂàýð ÃÂÃÂþü ÃÂÃÂõôÃÂÃÂòõ. ÃÂÃÂø õóþ øÃÂÿþûÃÂ÷þòðýøø ýð òÃÂàþôõ ÿþûÃÂÃÂðõÃÂÃÂàÿþûýþÃÂõýýþõ AJAX-ÿÃÂøûþöõýøõ (ÃÂÃÂþ ÃÂÃÂþ ÃÂðúþõ â ÃÂõüð þÃÂôõûÃÂýþù ÃÂÃÂðÃÂÃÂø, ÿÃÂøüõàâ Google Mail), ð ýð òàþôõ â òÃÂõ ÃÂþàöõ Java-úþô. àõÃÂõýøõ øýÃÂõÃÂõÃÂýþõ, ýõ ûøÃÂõýýþõ ÃÂòþøàôþÃÂÃÂþøýÃÂÃÂò ø ýõôþÃÂÃÂðÃÂúþò.
ÃÂàöõ ò ÃÂðüúðàôðýýþù ÃÂÃÂðÃÂÃÂø ÃÂðÃÂÃÂüþÃÂÃÂøü ëÃÂÃÂõôýõýÃÂúþõû ÃÂõÃÂõýøõ â Java Server Pages. àþÃÂýþòýþü â ø÷-÷ð õóþ ÃÂÃÂðýôðÃÂÃÂýþÃÂÃÂø, àþÃÂàôûàôðýýþóþ úþýúÃÂõÃÂýþóþ ÃÂûÃÂÃÂðàüþöýþ òÃÂñÃÂðÃÂàúðúþù-ýøñÃÂôàÃÂðñûþýýÃÂù ôòøöþú, ýðÿÃÂøüõÃÂ, ÃÂþàöõ Velocity (http://velocity.apache.org).
ÃÂñÃÂðàÃÂàõüð ÃÂðñþÃÂàÿÃÂøûþöõýøÃÂ
ÃÂþýÃÂò, ÃÂÃÂþ ýÃÂöýþ þÃÂôõûøÃÂàûþóøúàþàôø÷ðùýð, ôðòðùÃÂõ ÿþôÃÂüðõü, úðúøü þñÃÂð÷þü ÃÂÃÂþ üþöýþ ÃÂôõûðÃÂÃÂ. ÃÂÃÂõôûðóðàþÃÂÃÂðýþòøÃÂÃÂÃÂàýð ÃÂûõôÃÂÃÂÃÂõù ÃÂàõüõ - (àøÃÂ. 1).
áõÃÂòûõàòÃÂôðõàôðýýÃÂõ, ðñÃÂþûÃÂÃÂýþ ýõ ÷ðñþÃÂÃÂÃÂàþ ÃÂþü, úðú þýø ñÃÂôÃÂàþÃÂþñÃÂðöðÃÂÃÂÃÂÃÂ. ÃÂþ òÃÂôðõàþý øàýõ ò ëÃÂÃÂÃÂþüû òøôõ, ð ò ÿþûýþÃÂÃÂÃÂàþñÃÂðñþÃÂðýýþü, óþÃÂþòþü ôûàþÃÂþñÃÂðöõýøàýð ÃÂúÃÂðýõ (ýðÿÃÂøüõÃÂ, õÃÂûø ýÃÂöýþ ÿþûýþõ øüàÃÂõûþòõúð, ð ò ôðýýÃÂàâ õóþ äÃÂàÿþ þÃÂôõûÃÂýþÃÂÃÂø, ÃÂþ ÃÂõÃÂòûõàôþûöõý ÿÃÂõþñÃÂð÷þòðÃÂàòÃÂþÃÂþõ ò ÿõÃÂòþõ ÿõÃÂõô ÿõÃÂõôðÃÂõù ò JSP).
ÃÂþ÷ýøúðõàòþÿÃÂþÃÂ: úðú öõ ÿõÃÂõôðÃÂÃÂÃÂàôðýýÃÂõ þàÃÂõÃÂòûõÃÂð ò JSP? çõÃÂõ÷ ÃÂöõ ø÷òõÃÂÃÂýÃÂù ýðü þñÃÂõúàrequest. àýõüàëÿÃÂøúÃÂÃÂÃÂõýû ÃÂÿõÃÂøðûÃÂýÃÂù ðÃÂÃÂþÃÂøðÃÂøòýÃÂù üðÃÂÃÂøò ëString â Objectû, úþÃÂþÃÂÃÂù ýð÷ÃÂòðõÃÂÃÂàðÃÂÃÂøñÃÂÃÂðüø ø úþÃÂþÃÂÃÂù öøòõÃÂ, ÿþúð öøò ÷ðÿÃÂþÃÂ. àýõüàøüõõàôþÃÂÃÂÃÂÿ ø ÃÂõÃÂòûõÃÂ, ø JSP-ÃÂÃÂÃÂðýøÃÂð, ÿþÃÂÃÂþüàõóþ üþöýþ (ø ÃÂÃÂþ ÿÃÂðòøûÃÂýþ) øÃÂÿþûÃÂ÷þòðÃÂàôûàÿõÃÂõôðÃÂø ôðýýÃÂà.
ÃÂõÃÂõàþôøü ýð Tomcat
ÃÂþ ÃÂýðÃÂðûð ýÃÂöýþ ÿõÃÂõÿøÃÂðÃÂàýðàÃÂõÃÂòûõàëÿþ-ò÷ÃÂþÃÂûþüÃÂû. ÃÂÃÂÃÂÃÂþõýýÃÂù ÃÂõÃÂòõàâ ÃÂÃÂþ ÷ðüõÃÂðÃÂõûÃÂýþ ôûàúÃÂÃÂÃÂðÃÂýÃÂàÿÃÂþõúÃÂþò, ýþ þñÃÂÃÂýþ úþýÃÂõùýõàÃÂõÃÂòûõÃÂþò ÃÂöõ ÃÂÃÂþøÃÂ, ø ÿþôúûÃÂÃÂðÃÂÃÂÃÂàÃÂûõôÃÂõàú ýõüÃÂ.
ÃÂàñÃÂôõü øÃÂÿþûÃÂ÷þòðÃÂàTomcat 5.5. ÃÂÃÂþ úûðÃÂÃÂøÃÂõÃÂúøù, üþöýþ ôðöõ ÃÂúð÷ðÃÂÃÂ, ÃÂÃÂðýôðÃÂÃÂýÃÂù þÃÂúÃÂÃÂÃÂÃÂù ÃÂõÃÂòûõÃÂ-úþýÃÂõùýõÃÂ. ÃÂûàÃÂÃÂÃÂðýþòúø Tomcat ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂþ ÃÂúðÃÂðÃÂàõóþ àhttp://tomcat.apache.org (øûø ò÷ÃÂÃÂààýðÃÂõóþ DVD), ÃÂðÃÂÿðúþòðÃÂàø ÷ðÿÃÂÃÂÃÂøÃÂàbin/startup.sh (øûø ÃÂþþÃÂòõÃÂÃÂòÃÂÃÂÃÂøù .bat). Tomcat ÃÂðñþÃÂðõààÃÂðùûðüø ÃÂÿõÃÂøðûÃÂýþóþ ÃÂøÿð Web Archive (WAR). ÃÂñýðÃÂÃÂöøò ÃÂðúþù ÃÂðùû ò þÿÃÂõôõûõýýþü úðÃÂðûþóõ, Tomcat ÃÂð÷òþÃÂðÃÂøòðõàõóþ ø ÷ðÿÃÂÃÂúðõàÃÂþôõÃÂöðÃÂõõÃÂàò ýõü ÿÃÂøûþöõýøõ. çÃÂþñàÿõÃÂõ÷ðÿÃÂÃÂÃÂøÃÂàøûø þñýþòøÃÂàÿÃÂþóÃÂðüüÃÂ, ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂþ ÷ðüõýøÃÂàþôøý WAR-ÃÂðùû ôÃÂÃÂóøü.
ÃÂÃÂõôÃÂôÃÂÃÂøù úþô ýõ óþÃÂþò ôûàÃÂðñþÃÂààTomcat, ÿþÃÂÃÂþüàõóþ ýÃÂöýþ ýõüýþóþ ÿõÃÂõÿøÃÂðÃÂÃÂ. ÃÂþàÃÂÃÂþ ñÃÂôõàÃÂôõûðýþ:
- AddressBook ÿþÃÂõÃÂÃÂõàüõÃÂþôàstart ø main ø ÿÃÂõòÃÂðÃÂøÃÂÃÂàò ÿÃÂþÃÂÃÂþõ àÃÂðýøûøÃÂõ ÷ðÿøÃÂõù.
- AddressBookHandler ÿÃÂõòÃÂðÃÂøÃÂÃÂàò AddressBookServlet, ø ò ýõóþ ñÃÂôõàôþñðòûõýþ ÿÃÂøüõÃÂýþ ÃÂûõôÃÂÃÂÃÂõõ (ÃÂøÃÂÃÂøýó 1):
ÃÂøÃÂÃÂøýó 1. ÃÂþòÃÂù AddressBook
private AddressBook _addressBook = null; public void init(ServletConfig aServletConfig) throws ServletException { super.init(aServletConfig); _addressBook = new AddressBook(); } protected void doGet(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletException, IOException handle(aRequest, aResponse); } protected void doPost(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletException, IOException handle(aRequest, aResponse); }
áðü üõÃÂþô handle ÃÂþöõ ÃÂûõóúð ÿÃÂõþñÃÂð÷ÃÂõÃÂÃÂà(ÃÂøÃÂÃÂøýó 2):
ÃÂøÃÂÃÂøýó 2. ÃÂþòÃÂù üõÃÂþô handle
private void handle(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletException, IOException { aRequest.setCharacterEncoding("utf-8"); String target = aRequest.getRequestURI().substring( aRequest.getContextPath().length()); if (target.equals("/")) { _drawer.outputPage("index.jsp", aRequest, aResponse); } else if ("/add".equals(target)) { handleAdd(aRequest, aResponse); } else if ("/view".equals(target)) { handleView(aRequest, aResponse); } else if ("/edit".equals(target)) { handleEdit(aRequest, aResponse); } else if ("/remove".equals(target)) { handleRemove(aRequest, aResponse); } }
- ÃÂûàÃÂþóþ, ÃÂÃÂþñàTomcat ëÿþýÃÂûû, ÃÂÃÂþ õüàÿþûþöøûø ÃÂõÃÂòûõÃÂ, ø ÷ýðû, úðú õóþ þñÃÂðñðÃÂÃÂòðÃÂÃÂ, ýÃÂöýþ ýðÿøÃÂðÃÂàÃÂÿõÃÂøðûÃÂýÃÂù ÃÂðùû, úþÃÂþÃÂÃÂù ýð÷ÃÂòðõÃÂÃÂàëôõÃÂúÃÂøÿÃÂþÃÂû. ÃÂõÃÂüþÃÂÃÂàýð ÃÂþ, ÃÂÃÂþ ÃÂûþòþ ÃÂÃÂÃÂðÃÂýþõ, ÃÂÃÂþ ÿÃÂþÃÂÃÂþ XML-ôþúÃÂüõýààþÿøÃÂðýøõü ÃÂõÃÂòûõÃÂð. ÃÂÃÂûø ÿõÃÂõòõÃÂÃÂø àÃÂ÷ÃÂúð ýðÿøÃÂðýøàôõÃÂúÃÂøÿÃÂþÃÂþò ýð ÃÂÃÂÃÂÃÂúøù, ÃÂþ ÿþûÃÂÃÂøÃÂÃÂàÿÃÂøüõÃÂýþ ÃÂûõôÃÂÃÂÃÂðàøýÃÂþÃÂüðÃÂøÃÂ:
- ÃÂðàÃÂõÃÂòûõàýð÷ÃÂòðõÃÂÃÂàëABServletû ø ÷ðÿÃÂÃÂúðõÃÂÃÂàúûðÃÂÃÂþü AddressBookServlet. âõþÃÂõÃÂøÃÂõÃÂúø üþöýþ ýð÷òðÃÂàÃÂõÃÂòûõàÃÂðú öõ, úðú ø úûðÃÂÃÂ, ýþ üàýõ ñÃÂôõü ÃÂðú ôõûðÃÂÃÂ, ÃÂÃÂþñàñÃÂûþ üõýÃÂÃÂõ ÿÃÂÃÂðýøÃÂÃÂ.
- ÃÂûàòÃÂõàURL, úþÃÂþÃÂÃÂõ ýðÃÂøýðÃÂÃÂÃÂààë/û, ýÃÂöýþ òÃÂ÷ÃÂòðÃÂàÃÂõÃÂòûõÃÂ, úþÃÂþÃÂÃÂù ýð÷ÃÂòðõÃÂÃÂàABServlet.
àòþàúðú þý òÃÂóûÃÂôøà(ÃÂøÃÂÃÂøýó 3):
ÃÂøÃÂÃÂøýó 3. ÃÂõÃÂúÃÂøÿÃÂþàôûàÃÂõÃÂòûõÃÂð
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<servlet> <display-name>AddressBook</display-name> <servlet-name>Servlet</servlet-name> <servlet-class>AddressBookServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet>
<servlet-mapping> <servlet-name>Servlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
</web-app>
- ÃÂõÃÂúÃÂøÿÃÂþàñÃÂôõàýð÷ÃÂòðÃÂÃÂÃÂàweb.xml ø àÃÂðýøÃÂÃÂÃÂàò ÃÂÿõÃÂøðûÃÂýþü úðÃÂðûþóõ. ÃÂôõ øüõýýþ â þñÃÂÃÂôøü, úþóôð ñÃÂôõü ÃÂþñøÃÂðÃÂàÃÂõÃÂòûõàò WAR
. áôõûðùÃÂõ ÃÂúð÷ðýýÃÂõ ø÷üõýõýøàÃÂðüþÃÂÃÂþÃÂÃÂõûÃÂýþ øûø òþ÷ÃÂüøÃÂõ óþÃÂþ-òÃÂù úþô àDVD. ÃÂÃÂõ ò ÿþÃÂÃÂôúõ? âþóôð ôòøöõüÃÂàôðûÃÂÃÂõ.
ÃÂþòÃÂù üõÃÂþô
ÃÂÃÂûø ÿÃÂøÃÂüþÃÂÃÂõÃÂÃÂÃÂàñþûõõ òýøüðÃÂõûÃÂýþ ú úþôàýþòþóþ handle, üþöýþ ÷ðüõÃÂøÃÂÃÂ, ÃÂÃÂþ ÃÂðü ÿþÃÂòøûÃÂàòÃÂ÷þò üõÃÂþôð outputPage. àðýÃÂÃÂõ õóþ, ò þÃÂûøÃÂøõ þàÃÂð÷ýÃÂàhandle... ýõ ñÃÂûþ. ÃÂÃÂþ üõÃÂþô, úþÃÂþÃÂÃÂù òÃÂñøÃÂðõàJSP-ÃÂðùû ø ÿõÃÂõôðõàõüàÃÂÿÃÂðòûõýøõ ôûàòÃÂòþôð ÃÂÃÂÃÂðýøÃÂõú. ÃÂÃÂóûÃÂôøàüõÃÂþô ÃÂûõôÃÂÃÂÃÂøü þñÃÂð÷þü (ÃÂøÃÂÃÂøýó 4):
ÃÂøÃÂÃÂøýó 4. ÃÂõÃÂþô outputPage
public void outputPage(String aJSPName, HttpServletRequest aRequest, HttpServletResponse aResponse) throws IOException, ServletException { RequestDispatcher dispatcher = aRequest.getRequestDispatcher("/jsps/" + aJSPName); dispatcher.forward(aRequest, aResponse); }
àÃÂÃÂþü üõÃÂþôõ üàñõÃÂõü ýÃÂöýÃÂù JSP-ÃÂðùû ø óþòþÃÂøü ÃÂõÃÂòûõÃÂ-úþýÃÂõùýõÃÂÃÂ: ëÃÂñÃÂðñþÃÂðù, ÿþöðûÃÂùÃÂÃÂðû. ÃÂÃÂÃÂðûÃÂýþõ ñõÃÂõàýð ÃÂõñàúþýÃÂõùýõÃÂ. ÃÂý øÃÂõàJSP-ÃÂðùû, ÷ðóÃÂÃÂöðõàõóþ, úþüÿøûøÃÂÃÂõà(õÃÂûø ÃÂÃÂþ ýÃÂöýþ), òÃÂÿþûýÃÂõàÿþûÃÂÃÂøòÃÂøùÃÂàÃÂõÃÂòûõÃÂ, ð ÃÂõ÷ÃÂûÃÂÃÂðà÷ðÿøÃÂÃÂòðõàò aResponse.
JSP-ÃÂÃÂÃÂðýøÃÂÃÂ
ÃÂûàýðÃÂðûð ÃÂþ÷ôðôøü úðÃÂðûþó, ò úþÃÂþÃÂþü ñÃÂôõü ÃÂþñøÃÂðÃÂàýðÃÂõ øýÃÂõÃÂýõÃÂ-ÿÃÂøûþöõýøõ. ÃÂð÷òðÃÂàüþöýþ úðú ÃÂóþôýþ, ýðÿÃÂøüõÃÂ, WebApp (Web Application). àýõü ÃÂþ÷ôðôøü ÃÂÿõÃÂøðûÃÂýÃÂù úðÃÂðûþó WEB-INF, óôõ ôþûöõý ýðàþôøÃÂÃÂÃÂàôõÃÂúÃÂøÿÃÂþàweb.xml, ø úðÃÂðûþó jsps, ò úþÃÂþÃÂþü ñÃÂôÃÂààÃÂðýøÃÂÃÂÃÂàJSP-ÃÂÃÂÃÂðýøÃÂúø.
áþ÷ôðôøü ÃÂÃÂø JSP-ÃÂðùûð: ôûàøýôõúÃÂýþù ÃÂÃÂÃÂðýøÃÂúø, ôûàÃÂõôðúÃÂøÃÂþòðýøà(øûø ôþñðòûõýøÃÂ) ÷ðÿøÃÂõù ø ôûàÿÃÂþÃÂüþÃÂÃÂð, ø ýð÷þòõü øà, ÃÂþþÃÂòõÃÂÃÂÃÂòõýýþ, index.jsp, edit.jsp, view.jsp. ÃÂõ ÷ðñÃÂôÃÂÃÂõ â øàýÃÂöýþ ÃÂþàÃÂðýøÃÂàò ò WebApp/jsps.
áðü JSP ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂ. àðÃÂÃÂüþÃÂÃÂøü index.jsp (ÃÂøÃÂÃÂøýó 5):
ÃÂøÃÂÃÂøýó 5. index.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>ÃÂôÃÂõÃÂýðàúýøóð</title> </head> <body><h1>ÃÂôÃÂõÃÂýðàúýøóð</h1> <a href="<%=request.getContextPath()%>/add">ÃÂþñðòøÃÂà÷ðÿøÃÂÃÂ</a><br/> <a href="<%=request.getContextPath()%>/view">ÃÂÃÂþÃÂüþÃÂÃÂõÃÂà÷ðÿøÃÂø</a><br/> </body> </html>
ÃÂõÃÂòðàÃÂÃÂÃÂþÃÂúð ôþñðòûÃÂõàÿþûõ ëContent-typeû ú HTTP-÷ðóþûþòúàþÃÂòõÃÂð. ÃÂÃÂþ ÿÃÂÃÂüþù ðýðûþó ÃÂÃÂÃÂþúø
aRequest.setContentType("text/html; charset=utf-8")
ø÷ ëÃÂÃÂðÃÂþóþû üõÃÂþôð handle. àôðûÃÂÃÂõ, úÃÂþüõ ÃÂÃÂÃÂðýýÃÂàòÃÂÃÂðòþú <%...%>, øôõàþñÃÂÃÂýÃÂù HTML-úþô. àÃÂÃÂþ àþÃÂþÃÂþ! ÃÂÃÂþ ÿþýÃÂÃÂýþ! âõÿõÃÂàÃÂð÷ñõÃÂõüÃÂààýõÿþýÃÂÃÂýÃÂü.
àJSP üþöýþ òÃÂÃÂðòûÃÂÃÂàëøýþÃÂþôýÃÂùû ôûàHTML úþô, úþÃÂþÃÂÃÂù ÃÂÿõÃÂøðûÃÂýÃÂü þñÃÂð÷þü øýÃÂõÃÂÿÃÂõÃÂøÃÂÃÂõÃÂÃÂàÃÂõÃÂòõÃÂþü ø üþöõàñÃÂÃÂàøÃÂÿþûÃÂ÷þòðý ôûàòÃÂÃÂðòúø ÃÂð÷ûøÃÂýÃÂàôðýýÃÂà. ÃÂÃÂÃÂàýõÃÂúþûÃÂúþ ÃÂøÿþò ÃÂðúøàòÃÂÃÂðòþú.
- <%@...%> â þñþ÷ýðÃÂðõàÃÂÿõÃÂøðûÃÂýÃÂàòÃÂÃÂðòúÃÂ, úþÃÂþÃÂðàþÿÃÂõôõûÃÂõàÿðÃÂðüõÃÂÃÂàÃÂÃÂÃÂðýøÃÂÃÂ, ò ýðÃÂõü ÃÂûÃÂÃÂðõ â ContentType. ÃÂþöýþ ÷ðôðòðÃÂÃÂ, ýðÿÃÂøüõÃÂ, ÃÂ÷ÃÂú, ýð úþÃÂþÃÂþü ýðÿøÃÂðýð ÃÂÃÂÃÂðýøÃÂð. ÃÂý öõ øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂàôûàÃÂõúÃÂøù import (ÃÂü. view.jsp ýøöõ).
- <%=...%> â ÃÂÃÂþ ÿÃÂþÃÂÃÂþù òÃÂòþô ÿõÃÂõüõýýþù. ÃÂõùÃÂÃÂòøõ òÃÂÃÂðòúø <%=ÃÂÃÂþ-ýøñÃÂôÃÂ%> ðýðûþóøÃÂýþ òÃÂ÷þòàrequest.getWriter().write(ÃÂÃÂþ-ýøñÃÂôÃÂ).
- <%...%> â ÃÂðüÃÂù þñÃÂøù òðÃÂøðýàòÃÂÃÂðòúø, òýÃÂÃÂÃÂø üþöõàñÃÂÃÂàûÃÂñþù úþô. àýðÃÂõü ÃÂûÃÂÃÂðõ, ýð Java.
index.jsp â ÿÃÂþÃÂÃÂþù ÃÂðùû, ÿþÃÂüþÃÂÃÂøü ýð ýõÃÂÃÂþ ñþûõõ ÃÂûþöýþõ. ÃÂðÿÃÂøüõÃÂ, view.jsp (ÃÂøÃÂÃÂøýó 6).
ÃÂøÃÂÃÂøýó 6. view.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page import="java.util.*" %> <html> <head><title>ÃÂôÃÂõÃÂýðàúýøóð</title></head> <body><h1>ÃÂôÃÂõÃÂýðàúýøóð, ÃÂÿøÃÂþú úþýÃÂðúÃÂþò</h1> <a href="<%=request.getContextPath()%>">ÃÂð óûðòýÃÂÃÂ</a><br/> <span style="color: green;"><%=request.getAttribute("message")%></span> <table border="1"> <tr><td width="100">ÃÂüÃÂ</td><td width="100">ÃÂþüõÃÂ</td><td width="100">ÃÂþüüõýÃÂðÃÂøù</td><td> - </td></tr> <% Map numbers = (Map) request.getAttribute("numbers"); Map comments = (Map) request.getAttribute("comments"); for (Object entry : numbers.entrySet()) { String name = (String) ((Map.Entry) entry).getKey(); String number = (String) numbers.get(name); String comment = (String) comments.get(name); %> <tr> <td class="name"><%=name%></td> <td class="number"><%=number%></td> <td class="comment"><%=comment%></td> <td class="name"> <a href="<%=request.getContextPath()%>/remove?number=<%=number%>">ãôðûøÃÂÃÂ</a> <a href="<%=request.getContextPath()%>/edit?number=<%=number%>">àõôðúÃÂøÃÂþòðÃÂÃÂ</a> </td> </tr> <% } %> </table> </body> </html>
ÃÂðú üþöýþ ÷ðüõÃÂøÃÂÃÂ, ÷ôõÃÂàõÃÂÃÂàø øüÿþÃÂà(þ ÃÂõü àóþòþÃÂøû ÃÂÃÂÃÂàòÃÂÃÂõ), ø òÃÂÃÂðòúð Java-úþôð. ÃÂðýýÃÂù ÃÂðùû þÃÂûøÃÂýþ ÿþúð÷ÃÂòðõÃÂ, úðú, ýðÿÃÂøüõà(ýõ ÃÂðüÃÂù ûÃÂÃÂÃÂøù ÃÂÿþÃÂþñ, úþýõÃÂýþ), ÃÂôõûðÃÂàòÃÂòþô ò ÃÂøúûõ.
àúðú ÃÂÃÂþ þñÃÂðñðÃÂÃÂòðõÃÂÃÂÃÂ-ÃÂþ?
ÃÂÃÂÃÂõÃÂÃÂòõýýþ, ø üõÃÂþôàhandle... ÿþÃÂûõ ÃÂðúþóþ ø÷üõýõýøàÃÂÃÂðûø ôÃÂÃÂóøüø. ÃÂõÃÂàòÃÂòþô HTML-úþôð øÃÂÃÂõ÷, þÃÂÃÂðûðÃÂàÿþôóþÃÂþòúð ôðýýÃÂà, ø òÃÂ÷þò üõÃÂþôð outputPage. ÃÂþÃÂ, ýðÿÃÂøüõÃÂ, üõÃÂþô handleEdit(...) (ÃÂøÃÂÃÂøýó 7):
ÃÂøÃÂÃÂøýó 7. ÃÂõÃÂþô handleEdit, þñÃÂðñþÃÂúð ÃÂõôðúÃÂøÃÂþòðýøà÷ðÿøÃÂø
if (aRequest.getParameter("number") == null) { _addressBook.removeContactByNumber(aRequest.getParameter("number")); aRequest.setAttribute("message", "ÃÂõ þÿÃÂõôõûõýþ, ÃÂÃÂþ ÃÂõôðúÃÂøÃÂþòðÃÂÃÂ"); handleView(aRequest, aResponse); } else if (aRequest.getParameter("edited") != null) { _addressBook.editContact(aRequest.getParameter("edited"), aRequest.getParameter("name"), aRequest.getParameter("number"), aRequest.getParameter("comment")); aRequest.setAttribute("message", "ÃÂþýÃÂðúà\"" + aRequest.getParameter("name") + "\" þÃÂÃÂõôðúÃÂøÃÂþòðý"); handleView(aRequest, aResponse); } else { Contact contact = _addressBook.getContactByNumber(aRequest.getParameter("number")); aRequest.setAttribute("action", "edit"); aRequest.setAttribute("edit.name", contact.getName()); aRequest.setAttribute("edit.number", contact.getNumber()); aRequest.setAttribute("edit.comment", contact.getComment()); outputPage("edit.jsp", aRequest, aResponse); }
ÃÂÃÂÃÂðûÃÂýÃÂõ üõÃÂþôàüõýÃÂÃÂÃÂÃÂàðýðûþóøÃÂýþ â øàÿþûýÃÂù úþô üþöýþ ýðùÃÂø ýð ôøÃÂúõ.
àúðú òÃÂõ ÃÂÃÂþ òÃÂÃÂðòøÃÂàò Tomcat?
âõÿõÃÂààýðàõÃÂÃÂÃÂ:
- ÃÂûðÃÂÃÂàContact, AddressBook, AddressBookServlet.
- äðùû web.xml.
- ÃÂðÃÂðûþó jsps àÃÂðùûðüø edit.jsp, index.jsp, view.jsp.
ÃÂûàÃÂþóþ, ÃÂÃÂþñàTomcat ÿþýÃÂû, ÃÂÃÂþ õüàôðûø ÿþûýþÃÂõýýþõ ÿÃÂøûþöõýøõ, ýÃÂöýþ òÃÂÿþûýøÃÂàòÃÂõóþ ÃÂÃÂø ÃÂðóð:
- áúþüÿøûøÃÂþòðÃÂàòÃÂõ, ÃÂÃÂþ úþüÿøûøÃÂÃÂõÃÂÃÂÃÂ, ø ÃÂþ÷ôðÃÂàÿÃÂðòøûÃÂýÃÂàøõÃÂðÃÂàøàÃÂðùûþò ø úðÃÂðûþóþò, úþÃÂþÃÂðàÿÃÂõôÃÂÃÂðòûõýð ýð ÃÂøÃÂ. 2.
- áþ÷ôðÃÂàÃÂÿõÃÂøðûÃÂýÃÂù ÃÂðùû-þÿøÃÂðýøõ ðÃÂàøòð (ëüðýøÃÂõÃÂÃÂû).
- ÃÂððÃÂàøòøÃÂþòðÃÂàÃÂþ÷ôðýýÃÂàÃÂÃÂÃÂÃÂúÃÂÃÂÃÂàÿÃÂø ÿþüþÃÂø ÃÂÃÂøûøÃÂàjar, òàþôÃÂÃÂõù ò úþüÿûõúàJDK.
áúþüÿøûøÃÂÃÂõü ÃÂðùûÃÂ. âÃÂàýøÃÂõóþ ýþòþóþ ýõ ÿþÃÂòøûþÃÂÃÂ, ÃÂð÷òõ ÃÂÃÂþ ø÷üõýøûðÃÂàÃÂðüð úþüðýôð (þñÃÂðÃÂøÃÂõ òýøüðýøõ ýð úûÃÂà-cp, ÷ðôðÃÂÃÂøù ñøñûøþÃÂõúø classpath):
cd ~/Programming/AddressBook/src javac -encoding utf-8 -cp ~/bin/tomcat/common/lib/servlet-api.jar -d ../build/WEB-INF/classes/ *.java
ÃÂõÃÂõàþôøü ú ÃÂþ÷ôðýøàüðýøÃÂõÃÂÃÂð. ÃÂý ôþûöõý ýð÷ÃÂòðÃÂÃÂÃÂàMANIFEST.MF ø ÃÂðÃÂÿþûðóðÃÂÃÂÃÂàò úðÃÂðûþóõ META-INF. àÃÂÃÂðÃÂÃÂÃÂÃÂ, ÷ð ÃÂÃÂøü ÃÂûõôøàÃÂðü jar, ÿþÃÂÃÂþüàýðü ôþÃÂÃÂðÃÂþÃÂýþ ÿÃÂþÃÂÃÂþ ÃÂþàÃÂðýøÃÂàóôõ-ÃÂþ ÃÂðùû ø ÃÂúð÷ðÃÂàõóþ jar'àúðú üðýøÃÂõÃÂÃÂ. àýðÃÂõü ÃÂûÃÂÃÂðõ þý ÿÃÂõôõûÃÂýþ ÿÃÂþÃÂàø ýõ ÃÂþôõÃÂöøàøýÃÂõÃÂõÃÂýþù øýÃÂþÃÂüðÃÂøø, ýþ ò ÿÃÂøýÃÂøÿõ ÷ôõÃÂàüþóÃÂàÃÂðÃÂÿþûðóðÃÂÃÂÃÂàòÃÂÃÂúøõ ýðÃÂÃÂÃÂþùúø ôûà÷ðÿÃÂÃÂúð òðÃÂõóþ ÿÃÂøûþöõýøÃÂ. ÃÂþàõóþ ÃÂõúÃÂà(ÃÂøÃÂÃÂøýó 8):
ÃÂøÃÂÃÂøýó 8. ÃÂðýøÃÂõÃÂàôûàwar-ÃÂðùûð
Manifest-Version: 1.0 Created-By: Hands of programmer
âõÿõÃÂàÃÂþñõÃÂõü òÃÂõ ò war (Web Archive). ÃÂðýøÃÂõÃÂàôûàÿÃÂøòõôõýýþù ýøöõ úþüðýôàôþûöõý ñÃÂÃÂàýð÷òðý MANIFEST.MF ø ÃÂðÃÂÿþûðóðÃÂÃÂÃÂàÃÂÃÂôþü àúðÃÂðûþóþü build. àõ÷ÃÂûÃÂÃÂøÃÂÃÂÃÂÃÂøù ðÃÂàøò ýð÷ÃÂòðõÃÂÃÂàaddress.war ø ÃÂðÃÂÿþûðóðõÃÂÃÂàÃÂðü öõ, ÃÂÃÂôþü àüðýøÃÂõÃÂÃÂþü.
jar -cfm ../address.war ../MANIFEST.MF *
àÃÂõùÃÂðàýðÃÂÃÂÃÂÿðõàÃÂðüÃÂù òþûÃÂõñýÃÂù üþüõýÃÂ! ÃÂþ÷ÃÂüøÃÂõ address.war ø ÿþûþöøÃÂõ õóþ ò úðÃÂðûþó webapps Tomcat'ð. ÃÂþôþöôøÃÂõ ýõÃÂúþûÃÂúþ ÃÂõúÃÂýô. ãòøôõò ýþòþõ ÿÃÂøûþöõýøõ, Tomcat ÃÂð÷òõÃÂýõàõóþ (ÿþÃÂòûÃÂõÃÂÃÂàúðÃÂðûþó àøüõýõü òðÃÂõóþ war'ð) ø ÿþôúûÃÂÃÂøàú ÃÂøÃÂÃÂõüõ. ÃÂþÃÂûõ ÃÂÃÂþóþ üþöýþ ÿÃÂþÃÂÃÂþ ÷ðùÃÂø ò ñÃÂðÃÂ÷õàø ýðñÃÂðÃÂÃÂ:
http://localhost:8080/address/
ÃÂÃÂðûÃÂ, ÿþûÃÂÃÂøÃÂõ òðÃÂõ ÿÃÂøûþöõýøõ.
àÃÂÃÂþ ÃÂõÿõÃÂÃÂ?
àÃÂõÿõÃÂàüþöýþ üõýÃÂÃÂàJSP-ÃÂðùûàëýð ûõÃÂÃÂû ò ÃÂðÃÂÿðúþòðýýþü úðÃÂðûþóõ webapps/address/jsps. ÃÂÃÂø ÃÂÃÂþü ñÃÂôõàðòÃÂþüðÃÂøÃÂõÃÂúø ÿÃÂþøÃÂàþôøÃÂàýõÃÂúþûÃÂúþ ôõùÃÂÃÂòøù, ò ÃÂõ÷ÃÂûÃÂÃÂðÃÂõ úþÃÂþÃÂÃÂàÃÂðùûàÿþôàòðÃÂÃÂÃÂÃÂàÿÃÂøûþöõýøõü. âðú üõýÃÂõÃÂÃÂàôø÷ðùý ñõ÷ ÿõÃÂõúþüÿøûÃÂÃÂøø, ñõ÷ ÃÂõÃÂÃÂðÃÂÃÂð ÃÂõÃÂòõÃÂýþóþ ÿÃÂøûþöõýøÃÂ, úðú ÃÂÃÂþ àýðàñÃÂûþ ôþ ÃÂøàÿþÃÂ.
ï ÃÂÃÂøÃÂðÃÂ, ÃÂÃÂþ ýð ôðýýþü ÃÂÃÂðÿõ ÿÃÂøûþöõýøõ ëÃÂôÃÂõÃÂýðàúýøóðû ÃÂðñþÃÂðõààþÃÂþÃÂþ. ÃÂýþ òÃÂÿþûýÃÂõàÃÂòþø ýõÃÂûþöýÃÂõ ÃÂÃÂýúÃÂøø ø ÃÂüõõàø÷üõýÃÂÃÂÃÂÃÂàëýð ûõÃÂÃÂû ÿþ ÷ðÿÃÂþÃÂàÿþûÃÂ÷þòðÃÂõûÃÂ. ÃÂýþ ÿÃÂþÃÂÃÂþõ â ø ÃÂÃÂþ ÃÂÃÂÃÂàûø ýõ ÃÂðüþõ óûðòýþõ. ÃÂþ õÃÂÃÂàõÃÂõ ôþÃÂÃÂðÃÂþÃÂýþ ðÃÂÿõúÃÂþò, þ úþÃÂþÃÂÃÂàÃÂÃÂþøà÷ýðÃÂàÿÃÂø ÃÂð÷ÃÂðñþÃÂúõ ñþûõõ ÃÂûþöýÃÂàøýÃÂõÃÂýõÃÂ-ÿÃÂøûþöõýøù. ÃÂàÃÂðÃÂÃÂüþÃÂÃÂøü øàò ÃÂûõôÃÂÃÂÃÂøàÃÂÃÂðÃÂÃÂÃÂàôðýýþù ÃÂõÃÂøø. LXF