英文文献 科技类 原文及翻译 65文档格式.docx
- 文档编号:22639973
- 上传时间:2023-02-05
- 格式:DOCX
- 页数:14
- 大小:25.97KB
英文文献 科技类 原文及翻译 65文档格式.docx
《英文文献 科技类 原文及翻译 65文档格式.docx》由会员分享,可在线阅读,更多相关《英文文献 科技类 原文及翻译 65文档格式.docx(14页珍藏版)》请在冰豆网上搜索。
DbFormsbuildsontopofJavaServlets2.2andJavaServerPages1.1technologiesbySunMicrosystems.ItmakesextensiveuseoftheJSPTagLibraryextensionintroducedintheJSP1.1specification.
Theproject'
shomepageislocatedathttp:
//www.dbforms.organdcontainsacompleteusermanual,severaltechnicalarticles,sourceandbinarydistributions,onlineexamples,aCVS,mailinglists,andlotsofotherinformationrelatedtoDbForms.
DbFormsimplementstheconceptsoftheModel-View-Controller(MVC)designpattern.(SeeDesignPatterns:
ElementsofReusableObject-OrientedSoftware,ErichGamma,RichardHelm,RalphJohnson,andJohnVlissides,AddisonWesley,October1994.)YoudonotneedtoprovideanyController-relatedcode;
justfocusondefiningtheModelandcreatingtheJSPviewcomponentsoftheapplication(mainlyusingDbFormscustomtags).
ThefollowingdiscusseshowModel,ViewandControllerinteractinDbForms.
TheModel:
DatabaseObjectsDescribedbyDatabaseMetadata
TheuseofDbFormsistoperformoperationsondatabases.ThedatabasetablesaccessedbyaDbFormsapplicationmustbedeclaredinaXMLconfigurationfile(usuallystoredasWEB-INF/dbforms-config.xml),whichisparsedandevaluatedatWeb-applicationstartuptime.
AsshowninListing1,everytable(orview)tobeaccessedbyDbFormshastobedeclaredinsideofa<
table>
element.Allrelevanttablefieldsneedtobedeclaredinsideofa<
field>
elementnestedwithinitsrespective<
element.
ThereexistsatoolforgeneratingthisXMLdataautomatically.Thetoolreadsdatabasemetadataofaspecifieddatabaseandconstructsaconfigurationfile,asshowninListing1.TheController:
Parsing,Dispatching,andExecutingEvents
Aspointedoutabove,youdonotneedtoprovideanyController-relatedcodewhentheControllerisatrueinfrastructuralcomponent.However,it'
susefulifyouhaveanideaofwhat'
sgoingoninsidetheController.Thefollowinglinesprovidethatinformation.
TheControllerincludesseveralcomponents:
ControllerServlet:
thisservletisthesinglepointofentryforallincomingHTTPrequestsfromclients.
EventEngine:
anassistanttotheControllerServlet,itfocusesonfilteringHTTPrequestsforWebEventsandinstantiatesthem.
WebEventObjects:
allObjectsderivedfromtheabstractsuper-classWebEventhavetheabilitytoinitializethemselvesbyreadingagivenHTTPrequest.Theseeventsgetexecuted,eitherdirectlybytheControllerorbytheView.
Thefollowingdescriptionoftheexecutionofatypicaluseractionshouldgiveyouabetterpictureofwhatthecontrollerdoesandhowitinteractswiththeothercomponents:
1.Userpressesthebutton"
deleterow"
onhis/herDbFormsapplication.
2.ClientbrowsersubmitsdataviaHTTP-POSTtotheController-servlet.
3.TheControllerServletdelegatestheincomingrequesttotheEventEngine,whichdeterminesthemainevent(theuserexplicitlytriggeredtheeventbyclickingabutton).However,theremayoccurimplicitevents,too--i.e.,automaticupdatingofallchangedinputfieldsofalldatarows.
4.TheEventEnginecomponentparsesthatrequestanddeterminesthekindofactiontheuserwantstobeexecuted.
5.ItthencreatestheappropriateWebEvent(inourcase,aDeleteEvent)anddelegatestherequestObjecttothisnewly-createdWebEvent,whichfinalizesitsowninitialization.Afterthat,theEventEnginereturnstherecently-createdand-initializedeventbacktotheControllerServlet.
6.TheControllerServlettellstheeventtoexecuteitsbuilt-inoperation,ifitisaDatabaseEvent.Otherevents(NavigationEvent,etc.)aredelegatedtotheappropriateViewcomponent.
7.TheControllerServletinvokesEventEngineagaintocheckifthereareadditional(implicit)eventstobeexecuted.Ifso,theappropriatedWebEventObjectsarecreatedandexecutedinthesamemannerasthemaineventdescribedabove.
8.TheControllerServletdeterminestheViewcomponenttowhichtherequestshouldbeforwarded.Iffound,theControllerServletinvokesthecomponentandforwardstherequest.
9.IftheViewcomponentisaJSPpagecontainingDbFormstags,thosetagswillsearchfornavigationeventstobeexecuted,andwillfinallygeneratetheresponsefortheuser.
10.Theresponseisrenderedbytheuser'
sWebbrowser.
TheView:
JSPTemplatesProvidedbytheApplicationDeveloper
TheViewportionofaDbFormsapplicationisgenerallyconstructedusingJSPtechnology.JSPfilesmaycontainstaticHTMLelements,aswellasdynamicelementscontainingJavacode(definitions,statements,expressions).FormoreinformationaboutJSP,pleaseseeSun'
sJSPpage.
Withrelease1.1oftheJSPAPI,apowerfulfacilitycalledJSPtaglibrarieswasadded.Withthesecustomtags,youcanencapsulateevenmostsophisticatedJavacodeintolightweightJSPtags.
DbFormsmakesuseofthegreatpotentialofJSPtaglibraries.Itcontainsanextensivecustomtagslibraryforrenderingandmanipulatingdatabasedata.
TheStructureofaDbFormsView
Figure1givesaconceptualoverviewofthemaincomponentsofatypicalDbFormsview.
TheBasicConceptsofForms
EachDbForms-viewJSPmayhaveoneormoreroottagsofthetypeform.Everyformtaghastocontainexactlyoneheadertag,exactlyonebodytag,andexactlyonefootertag,inexactlythatorder.
Eachofthosetagsmaycontainsub-elementslikedatafields,inputfields,actionbuttons,and--ofcourse--plainHTMLtextandJSPcode.
headerandfootertagsarecommonlyusedfortitlesofpages,labellingtables,placingactionandnavigationbuttons,inputfieldstoenternewdata,etc.headerandfootertagsgetevaluatedonlyonce.
Thebodytagisusedforshowingdatarowscomingfromthedatabase,andforprovidingtheuserwiththefunctionalitytoeditthatdata.Howmanytimesthebodytaganditssub-elementsgetrendereddependsonthevalueofthemaxRowsattributeoftheformelement(andofcourse,onthenumberofdatasetsactuallyfetchedfromthedatabase).
maxRows=n--bodygetsexecutedntimesatmaximum(withninN)
maxRows="
*"
--bodygetsexecutedforeveryrowinthetable("
endless"
form)
NestedForms
Everyformmaycontainoneormorenestedsub-formsinsideitsbodyelement.
The"
orders"
formisnestedwithinthebodyelementofthe"
customer"
form,asshowninFigure2.Theuserwillseeonecustomerperpage(becausemaxRowsissetto"
1"
)andalltheorders(becausemaxRows="
)thecustomerhastaken.Theusermaynavigatethroughthelistofcustomersbyclickingthenavigationbuttons.
OK,Let'
sSeeSomeCode!
Asstatedbefore,JSPviewsaretheonlypartsofaDbFormsapplicationadeveloperusuallyneedstoputhis/herhandson.DbFormsprovidesanextensivecustomtaglibrarywhichmakesthisaneasytask,sothatitcanbeperformedevenbynon-programmers.
Aswewillseelater,muchofthiscodecanbegeneratedautomaticallybytoolsincludedinDbForms.However,itisusefultounderstandthebasicsofDbFormsviews,evenifmuchoftheworkcanbedoneautomatically.
ThefollowingtwosectionswillshowasimpleandamoreadvancedexampleofaDbFormsview.BothexamplescanbethoughtasbeingpartsofalittleCRMapplicationofa(virtual)agency.
ASimpleExample
Description:
ThisJSPview(service.jsp)enablestheuser(s)toadministertheservicestheagencyprovidestoitscustomers.Theuser(anemployeeoftheagencyorcallcenteragent)shouldgetalistofalltheexistingservices,alongwithtextfieldsandbuttonstoupdateanddeletedata.Finally,anemptyinputmaskforinsertingnewservicesisneeded.
WehavesetmaxRowsto"
whichhastheeffectthatallrowswillbeshownatonce.Ifthereexisthundredsofservices,wewouldliketosetmaxRowsto"
10,"
"
20,"
oranotherlimitednumber,andwewouldinstantiatenavigationbuttonsforscrollingbetweenthepages.Wewillusethatpatternlater.
Theerrorstagshowsalistoferrors,ifanyoccurred(i.e.duplicatekeyerror,etc.).
TheupdateButtonanddeleteButtontagsareplacedinthebodyandthereforerenderedforeachrow.
AnExampleofNestedForms
Thefollowingpage(customer_order.jsp)givesyouthefunctionalitytomanagetheincomingordersofacustomer.Youareabletoeditbothordersofacustomerandthecustomerdataitself.Furthermore,youdonotneedtostrugglewithplainserviceIDs,butwillbeabletoconvenientlyselecttheservicesfromaselectboxbyname.
Withthispage,wehavedemonstratedanothercoupleofm
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 英文文献 科技类 原文及翻译 65 英文 文献 科技 原文 翻译
![提示](https://static.bdocx.com/images/bang_tan.gif)