英文文献 科技类 原文及翻译 65文档格式.docx

上传人:b****7 文档编号:22639973 上传时间:2023-02-05 格式:DOCX 页数:14 大小:25.97KB
下载 相关 举报
英文文献 科技类 原文及翻译 65文档格式.docx_第1页
第1页 / 共14页
英文文献 科技类 原文及翻译 65文档格式.docx_第2页
第2页 / 共14页
英文文献 科技类 原文及翻译 65文档格式.docx_第3页
第3页 / 共14页
英文文献 科技类 原文及翻译 65文档格式.docx_第4页
第4页 / 共14页
英文文献 科技类 原文及翻译 65文档格式.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

英文文献 科技类 原文及翻译 65文档格式.docx

《英文文献 科技类 原文及翻译 65文档格式.docx》由会员分享,可在线阅读,更多相关《英文文献 科技类 原文及翻译 65文档格式.docx(14页珍藏版)》请在冰豆网上搜索。

英文文献 科技类 原文及翻译 65文档格式.docx

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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 财务管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1