




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
东华理工大学毕业设计外文翻译PAGEPAGE1JSPTechnology(外文原文)JSP(JavaServerPages)isakindofbasedonJavascripttechnology.InmanyoftheadvantagesofJSP,oneofwhichisitcantheHTMLcodefromWebpagesinthebusinesslogicoftheeffectivelyseparated.WithJSPvisitreusablecomponents,suchasServlet,JavaBeanandbasedonJavaWebapplications.JSPalsosupportinWebpagedirectembeddedJavacode.ThetwomethodscanvisitJSPfiles:browsertosendfilesrequest,senttotheJSPServletrequest.JavaServerPagestechnologyisanextensionoftheJavaServlettechnology.Servletsareplatform-independent,server-sidemodulesthatfitseamlesslyintoaWebserverframeworkandcanbeusedtoextendthecapabilitiesofaWebserverwithminimaloverhead,maintenance,andsupport.Unlikeotherscriptinglanguages,servletsinvolvenoplatform-specificconsiderationormodifications;theyareapplicationcomponentsthataredownloaded,ondemand,tothepartofthesystemthatneedsthem.Together,JSPtechnologyandservletsprovideanattractivealternativetoothertypesofdynamicWebscripting/programmingbyoffering:platformindependence;enhancedperformance;separationoflogicfromdisplay;easeofadministration;extensibilityintotheenterprise;and,mostimportantly,easeofuse.TheUnifiedExpressionLanguage(EL)ThesimpleELincludedinJSP2.0technologyoffersmanyadvantagestothepageauthor.Usingsimpleexpressions,pageauthorscaneasilyaccessexternaldataobjectsfromtheirpages.TheJSPtechnologycontainerevaluatesandresolvestheseexpressionsasitencountersthem.ItthenimmediatelyreturnsaresponsebecausetheJSPrequest-processingmodelhasonlyonephase,therenderphase.However,becausetherequest-processingmodeldoesnotsupportapostback,allJSPexpressionsareread-only.UnlikeJSPtechnology,JavaServerFacestechnologysupportsamultiphaselifecycle.WhenauserentersvaluesintotheJavaServerFacesUIcomponentsandsubmitsthepage,thosevaluesareconverted,validated,andpropagatedtoserver-sidedataobjects,afterwhichcomponenteventsareprocessed.Inordertoperformallthesetasksinanorderlyfashion,theJavaServerFaceslifecycleissplitintoseparatephases.Therefore,JavaServerFacestechnologyevaluatesexpressionsatdifferentphasesofthelifecycleratherthanimmediately,asJSPtechnologywoulddo.JSPtechnology--friendorfoe?Presentationtechnologywasdesignedtotransformplainol'rawWebcontentintocontentwrappedinanattractivepresentationlayer.JavaServerPages(JSP)technology,Sun'spresentationmodelandpartoftheJ2EEplatform,hasreceivedsignificantattention.TherearebothadvantagesanddisadvantagestousingJSPtechnology,andWebdevelopersshouldbeawareofthegoodandthebad--andknowthattheydon'thavetobelimitedtothissingletechnology.Infact,thesedaysanumberofpresentationtechnologiesareavailable.Thisarticlebeginsbydefiningtheproblemspresentationtechnologiesweredesignedtosolve.ItthenexaminesthespecificstrengthsandweaknessesoftheJSPmodel.Finally,itintroducessomeviablealternativestoSun'spresentationtechnology.AbitofhistoryBeforedivingintoanexplanationofpresentationtechnology,it'shelpfultofillinsomedetailsonthesituationthatledtothebirthofthetechnology.Just10shortyearsago,thetermthinclientwasanovelty.Westilllivedinaworldofdesktopapplications,poweredbywimpy286microprocessorswith14-inchmonitorsthatwesquintedat.Boy,havetimeschanged!NowmydesktopdoesnothingbutpoweraWebbrowser,whileserversfromSun,IBM,HP,Compaq,andtherestchurnoutcomputations,businesslogic,andcontent.Andthatlittlemonitor?Replacedbyflat-screen,plasma,whopping21-and25-inchbeauties.Why?SowecanseetheintricateandcomplexHTMLdisplaysthatserveasafront-endtothesepowerfulapplications.Nolongerdoesaclunkyinterfacesuffice;nowweexpectflashygraphics,movingimages,color-coordinatedpresentationsthatwouldlookgoodinanyroominthehouse,andspeedyrenderingtoboot.ThepremiseToday,adecadebeyondthosefledglingWindowsapplications,wearestilldealingwiththishugeshiftinthepresentationparadigm.ThewoefulVisualBasicandCprogrammerswhoremainnowfindthemselvesworkingeitheronback-endsystemsorWindows-onlyapplications,ortheyhaveaddedaWeb-capablelanguagesuchastheJavalanguagetotheirtoolbox.Anapplicationthatdoesn'tsupportatleastthreeoffourML-isms--suchasHTML,XML,andWML--isconsideredshabby,ifnotanoutrightfailure.And,ofcourse,thatmeansweallcareverydeeplyabouttheabilitytoeasilydevelopaWebpresentationlayer.Asitturnsout,usingthenewInternet,andallthelanguageswehaveatourdisposal--Java,C,Perl,Pascal,andAda,amongothers--hasn'tbeenaseasyaswemighthavehoped.Anumberofissuescreepupwhenitcomestotakingtheprogramminglanguageseveryoneusedforback-endsystemsandleveragingthemtogeneratemarkuplanguagesuitableforaclient.Withthearrivalofmoreoptionsonthebrowser(DHTMLandJavaScriptcoding,forexample),theincreaseingraphicartisttalentintheWebdomain,andtoolsthatcouldcreatecomplexinterfacesusingstandardHTML,thedemandforfancyuserinterfaceshasgrownfasterthanourabilitytodevelopthesefrontendstoourapplications.Andthishasgivenrisetopresentationtechnology.Presentationtechnologywasdesignedtoperformasingletask:convertcontent,namelydatawithoutdisplaydetails,intopresentation--meaningthevarioususerinterfacesyouseeonyourphone,PalmPilot,orWebbrowser.Whataretheproblemsthatthesepresentationtechnologiesclaimedtosolve?Let'stakealook.Segregationvs.integrationTheprimarypurposeofpresentationtechnologyistoallowaseparationbetweencontentandpresentation.Inotherwords,businesslogicunits(presumablyinsomeprogramminglanguagelikeCorJava)don'thavetogeneratedatainapresentation-specificmanner.Data,orcontent,isreturnedraw,withoutformatting.Thepresentationtechnologythenappliesformatting,orpresentation,tothiscontent.Theresultisanamalgamofdatasurroundedbyandintertwinedwithgraphics,formatting,colors,andlogos.LookattheexamplesinListing1andListing2toseeataglancethedifferencebetweenrawcontentandcontentcombinedwithpresentationtechnology.Listing1showsrawcontent,withnothingbutdata,thatcouldbeusedinavarietyofways.class=displaycodeRussellCroweTomHanksMegRyanMaryStuartMastersonAlecBaldwinAshleyJuddKeanuReevesListing2,whichismuchmorecomplexthantheoneabove,showsthesamedatawrappedinpresentationtechnologyandreadyfordisplayinanHTML-capablebrowser.class=displaycode<HTML><HEAD><TITLE>SearchResults:Actors</TITLE></HEAD><BODY><H2ALIGN="center">SearchResults:Actors</H2><CENTER><HRwidth="85%"><TABLEwidth="50%"CELLPADDING="3"CELLSPACING="3"border="1"BGCOLOR="#FFFFCC"><TRBGCOLOR="#FFCCCC"><THwidth="50%"ALIGN="center">LastName</TH><THwidth="50%"ALIGN="center">FirstName</TH></TR><TR><TDwidth="50%">Baldwin</TD><TDwidth="50%">Alec</TD></TR><TR><TDwidth="50%">Crowe</TD><TDwidth="50%">Russell</TD></TR><TR><TDwidth="50%">Hanks</TD><TDwidth="50%">Tom</TD></TR><TR><TDwidth="50%">Judd</TD><TDwidth="50%">Ashley</TD></TR><TR><TDwidth="50%">Masterson</TD><TDwidth="50%">MaryStuart</TD></TR><TR><TDwidth="50%">Reeves</TD><TDwidth="50%">Keanu</TD></TR><TR><TDwidth="50%">Ryan</TD><TDwidth="50%">Meg</TD></TR></TABLE></CENTER>WhilethecontentinListing1isclearandeasyfortheuninitiatedlaypersontobothuseandunderstand,thecontentinListing2isveryspecifictothetaskofdisplayinabrowser.Itistrickytoextractdatafromitormanipulateitforanyotherpurpose.Thisfundamentaldifference,theprocessofsegregatingcontentfrompresentationinsteadofintegratingthetwo(atleastuntiltheuserneedstheinformation),isthebasicpremiseofanypresentationtechnology,includingtheJSPtechnology.Further,anypresentationtechnologythatdoesnotaccomplishthisbasicgoaldoesnottrulyaccomplishthegoalitwascreatedtoachieve.Workvs.reworkBesidestheseparationofcontentandpresentation,anothermeasureofapresentationtechnology'susefulnessistheamountofreworkthatiteliminates.Thedivergenceofpresentationandcontentenforcesadivergenceintherolesofthosedevelopingthecontent.Aprogrammercanfocusontherawcontentpresentedintheexamplesabove,andagraphicartistorwebmastercanattendtothepresentation.Aslightoverlapofrolesremains,however,intheprocessoftakingthepresentation--ormarkup--designedbytheartistandapplyingittothecontenttheprogrammer'scodedelivers.Inthesimplestcase,theartistsuppliesthemarkup,andthedeveloperprovidescodeandalsoplugsthemarkupintothepresentationtechnology.Theapplicationis"startedup,"andthecontentmagicallybecomesauserinterface.Ofcourse,asweallknow,developmentrarelyendsthere.Nextcomerevisionsandchangestotheinterfaceandnewbusinessrulesthatmustbecoded.Thisiswherethetruetestofthepresentationtechnology'sflexibilitycomesintoplay.Whileitisusuallysimpletoupdatetherawcontentbeingfedintothepresentationlayer,rarelycanthegraphicartistseasilyedittheiroriginalwork.Changestothepresentationlayerarecommon(we'veallbeenvictimtomarketingdepartmentschangingthisorthat).Sonowaproblemarises:whatdothedesignerschangetotweaktheirwork?Theoriginalmarkuplanguagepagetheygavetothedeveloper?Probablynot,asthatpagehasmostlikelyhadcustomtagsorcodeinserted(JSPpages,templateengines),convertedtoaJavaservlet,orchangedintosomethingtotallyunrecognizable.Oftenthedesignermustreworktheoriginalpageandresubmitthispagetothedeveloper.Thenthedeveloperhastoreconvertthispagetothespecificformatneededforuseinthepresentationtechnology.Alternatively,thedesignerhastolearnascriptinglanguageoratleastknowthatwhichareasofthepage'ssourcecodefromthedeveloperareofflimits.Ofcourse,thisisanerror-prone,dangerouswaytooperate.Onceyou'vedeterminedthatapresentationtechnologyallowsacleansplitbetweencontentandpresentation,youshouldtrytoensurethataminimumamountofreworkisnecessaryinordertomakepresentationchanges.ThepromiseofJSPtechnologyNow,ontothespecificsofJSPcoding.ThepromiseofJSPtechnologyistosupplythedesigneranddevelopertheonlypresentationtechnologytheywilleverneed.JSPtechnologyispartoftheJ2EEplatform,whichisthestrongestshowofsupportSuncangiveoneofitsJavaproducts.Togiveyouanideaofhowprevalentthissolutionis,tryrunningasearchon'JSP'at;you'llfindmorebooksdevotedtoJSPtechnologythanaboutalmostanyothersingleJavaAPI.BeforeIdiveintothespecificproblemsthatJSPtechnologypresents,youneedaclearunderstandingofwhatitclaimstodo.Contentvs.presentation Aboveall,JSPtechnologyisaboutseparatingcontentfrompresentation,foremostinSun'spublishedsetofgoalsforJSPpages.Infact,JSPdesignstemmeddirectlyfromthecomplaintsofdeveloperswhoweretiredoftypingout.println("<HTML><HEAD><TITLE>"+pageInfo.getTitle()+"</TITLE></HEAD>");intotheirservletcode.Thismixingofhard-codedcontentwithruntimevariablespresentedahorribleburdenonservletdevelopers.Italsomademakingevenminorchangestothepresentationlayerdifficultforthedeveloper.JSPtechnologyaddressesthissituationbyallowingnormalHTMLpages(andlater,WMLorothermarkuplanguagepages)tobecompiledatruntimeintoaJavaservlet,essentiallymimickingtheout.println()paradigm,withoutrequiringthedevelopertowritethiscode.Anditallowsyoutoinsertvariablesintothepagethatarenotinterpreteduntilruntime.InaJSPpagetheHTMLsnippetshowninListing2couldlookliketheexampleinListing3.class=displaycode<%@pageimport="com.ibm.display.PageUtils"%><%@pageimport="com.ibm.display.PageInfo"%><%PageInfopageInfo=(PageInfo)session.getAttribute("PAGE_DATA")%><HTML><HEAD><TITLE><%=pageInfo.getTitle()%></TITLE></HEAD><BODY><!--OtherHTMLcontent--></BODY></HTML>Judgingbytheseinitialprinciples,then,JSPtechnology(atleastinitsstateddesign)wouldsatisfythefirsttenetofapresentationtechnology,asoutlinedabove:thatcontentbeseparatedfrompresentation.Codevs.markupSecondontheJSPtechnology'slistoffeaturesissomethingthatmightraiseabitofconcern.JSPcodingletsyouinsertJavacodedirectlyintoapageofmarkup.Tounderstandwhythisdecisionwasmade,recallthatwhentheJSPspecificationwasbeingdeveloped,Sun'scompetitionfromMicrosoftwasatanall-timehigh,primarilyduetothesuccessofMicrosoftActiveServerPages(ASP).ThesimilarityofthenameJavaServerPagestoActiveServerPageswasnotmerelycoincidental.AndtheabilitytomimicmanyofASP'sfeatureswasalsointentional.SoJSPauthorsweregiventheoptiontoaddJavacodeintotheirmarkup.AsanexampleofJavacodebeingaddedtomarkup,theJSPsnippetinListing4dynamicallyaddsrowsasneededtoshoweachitemintheVectorofactors.class=displaycode<%@pageimport="com.ibm.display.PageUtils"%><%@pageimport="com.ibm.display.PageInfo"%><%@pageimport="com.ibm.people.Actor"%><%@pageimport="java.util.Iterator"%><%@pageimport="java.util.Vector"%><%PageInfopageInfo=(PageInfo)session.getAttribute("PAGE_DATA")Vectoractors=pageInfo.getActors()%><HTML><HEAD><TITLE><%=pageInfo.getTitle()%></TITLE></HEAD><BODY><H2ALIGN="center">SearchResults:Actors</H2><CENTER><HRwidth="85%"><TABLEwidth="50%"CELLPADDING="3"CELLSPACING="3"border="1"BGCOLOR="#FFFFCC"><%for(Iteratori=actors.iterator();i.hasNext()){Actoractor=(Actor)i.next();%><TRBGCOLOR="#FFCCCC"><THwidth="50%"ALIGN="center"><%=actor.getLastName()%></TH><THwidth="50%"ALIGN="center"><%=actor.getFirstName()%></TH></TR><%}%></TABLE></CENTER></BODY></HTML>RememberthatsofarIamsimplydescribingtheinitialdesigngoalsofJSPtechnology;I'lldefermyownjudgmentaboutthegoalsuntilalatersectionabouttheproblemsofJSPtechnology.Youmightbealittlesuspiciousalready,however,sinceembeddingcodeintoaJSPpagewouldseemtocauseproblemswiththefirstgoalofJSPtechnology,separatingcontentfrompresentation.Butreally(ahem),I'mnoteditorializingyet.Designervs.developerAfinal(andadmirable)goalofJSPtechnologyworthmentioningisthatitseekstoestablishclearlydefinedrolesintheapplicationdevelopmentprocess.Byostensiblybreakingcontentfrompresentation,JSPtechnologycreatesaclearerdistinctionbetweenthedesigneranddeveloper.Thedesignercreatesmarkup,usingonlystandardHTML,WML,orwhateverlanguageisappropriate,andthedeveloperwritescode.Ofcourse,manydesignerstodayhavelearnedJavaScript,soitshouldcomeasnosurprisethatmanyofthesesamedesignershavebeguntolearnJSPcoding.Often,insteadofjustdoingpuremarkup,theyencodeacompleteJSPpageandhanditovertothedeveloper.Thentheusualtweakingtakesplace,andthedeveloperputstheJSPpageintoplaceasafront-endforsomeportionoftheoverallapplication.Thekey,though,isthatmanydesignersdonotlearnJSPcoding,soitmustalsobeworkableinthatenvironment.TheproblemsI'vespelledoutwhatagoodpresentationtechnologyshouldprovide,aswellasthespecificproblemsthatJSPtechnologyseekstoaddress.Now,I'mreadytocuttothechase:JSPtechnology,whilebuiltongoodideas,presentsquiteafewproblems.BeforeyouchoosetouseJSPcodinginyourapplications(whichyoumightstilldo),youshouldatleastbeawareofpossiblepitfalls.YoushouldalsobeawareofafacetoftheJ2EEprogrammingplatformthatisoftenignored:justbecauseanAPIcomeswiththeplatformdoesn'tmeanyouhavetouseit.Assillyasthissounds,manydevelopersarestrugglingwiththeJSP,orEJB,orJMSAPIs,thinkingiftheydon'tusetheseAPIs,theirapplicationssomehowwon'treallybe"J2EEapplications."Infact,theplatformboastsmoreAPIsthanmostapplicationsneed.IfyouhaveproblemswithordoubtsaboutJSPtechnology,youdon'thavetouseit!TakeacloselookatboththepositivesandthenegativesbeforechoosingtouseJSPtechnologyinyourapplications.Let'stakealookatsomeofthenegatives.Portabilityvs.languagelock-inJSPtechnologylocksyouintoaspecificlanguage.Thispointshouldn'tbegiventoomuchweight.Javatechnologyforenterpriseapplications(inmyopinion,atleast)istheonlylanguagechoice.Andtherearenolanguage-independentsolutionsinthisspaceanyway.Ofcourse,atthisstageofthegame,I'mdisregardingtheMicrosoft.NETplatformforthesmokeandmirrorsitis.Onlytimewilltellwhetherthatplatformwilldevelopintoonethatistrulylanguage-independent.(I'mmorethanabitdubious.)Still,choosingJSPtechnologyforcesyoutousetheJavalanguage,atleastforpresentationandcontent.WhileCORBAcanbeusedforbusinesslogic,JSPcodingdoesnecessitatesomefamiliaritywithservletsaswellasthecoreJavalanguage.SincemanydeveloperscometoJSPcodingthroughtheJ2EEplatform,thisdoesn'tusuallypresentaproblem.Minglingvs.independenceThroughoutthisarticle,I'vecomebacktotheideaofseparatingcontentfrompresentation.You'reprobablyprettysickofhearingaboutthis,sonow'sthetimetodeterminewhetherornotJSPactuallyaccomplishesthisgoal.AsI'vealreadydiscussed,JSPclaimstohavebeendesignedforthisseparationpurpose,andthereforeweshouldassumeitachievesitsobjectives,right?Notnecessarily.BlurringthelinebetweencontentandpresentationJSPallowsJavacodetobeinsertedintothemarkuplanguagepage,andthisratherdangerousfeatureallowscontenttobeintermingledwithpresentation.Evenworse,businesslogicoftenmakesitswayintoJSPpages,asshowninListing5.class=displaycode<%@pageimport="com.ibm.display.PageUtils"%><%@pageimport="com.ibm.display.PageInfo"%><%@pageimport="com.ibm.logic.AdminUtils"%><%@pageimport="com.ibm.people.Actor"%><%@pageimport="java.util.Iterator"%><%@pageimport="java.util.Vector"%><%PageInfopageInfo=(PageInfo)session.getAttribute("PAGE_DATA")%><HTML><HEAD><TITLE><%=pageInfo.getTitle()%></TITLE></HEAD><BODY><H2ALIGN="center">SearchResults:Actors</H2><CENTER><HRwidth="85%"><TABLEwidth="50%"CELLPADDING="3"CELLSPACING="3"border="1"BGCOLOR="#FFFFCC"><%//Basedonuser'spermissions,performsearchdifferently(businesslogic!)Vectoractors=pageInfo.getActors()if(pageInfo.getUserInfo().hasPermission("ADMINISTRATOR")){actors=AdminUtils.getActors(pageInfo.getSearchCriteria());}else{actors=pageInfo.getActors();}for(Iteratori=actors.iterator();i.hasNext()){Actoractor=(Actor)i.next();%><TRBGCOLOR="#FFCCCC"><THwidth="50%"ALIGN="center"><%=actor.getLastName()%></TH><THwidth="50%"ALIGN="center"><%=actor.getFirstName()%></TH></TR><%}%></TABLE></CENTER></BODY></HTML>JSPadvocatesarequicktoletyouknowthatJSPtaglibrariescanhelpyouavoidthisproblem.Taglibrariesallowcustomtags(forexample,<AUTHORS/>)tobeaddedtoaJSPpage,whichatruntimeareresolvedintocodefragmentsin,well,taglibraries.TheuseofacustomtagandassociatedtaglibrarywouldallowtheexampleabovetobeconvertedtothatshowninListing6.class=displaycode<CENTER><TABLEwidth="50%"CELLPADDING="3"CELLSPACING="3"border="1"BGCOLOR="#FFFFCC"><ACTORS/></TABLE></CENTER>Atruntime,thecodeforthistagexecutesandthecorrectresultsareinsertedintothepage.Butthisdoesnotsolvetheproblem.TheargumentagainstJSPtechnologyisnotwhethercontentandpresentationcanbeseparated,butwhethertheymustbeseparated.AslongasJSPcodingallowsinlinecoding,itisveryconvenient(especiallywhendeadlinesarelooming)tomakelast-minutechangeswithinlinecode,ratherthanconvertingthecodetoataglibrary.Ifthisdoesn'tringtrue,considerwhytheJavalanguageimmediatelygainedpopularityoverCandC++:JavadisallowedmanyofthefeaturesthatwereproblematicinC,suchaspointeraddition.Whileyoucanalwaysarguethatyoudon'thavetoperformpointeradditioninCorthatnogoodprogrammerwouldeverinsertcodescriptlets,weallknowwhathappensinpractice.TheJavalanguageisabetterlanguagebecauseitmandatesthatthesesortsofbadhabitsneversurface.ButJSPinthiscaseismuchlikeC,allowingsomeverybadpractices.AnadditionallitmustestoftheJSPtechnology'ssuccessinmeetingitsstatedobjectivesistoseewhetherornotitispossibletoachievethisgoalinpractice;certainlyitisn'tfairtoholdJSPtoanimpossiblestandard.Mosttemplateengines,likeFreeMarkerandWebMacro,havethissameinlinecodingfacility,oftenwithaPerl-analoguelanguage.However,technologieslikeEnhydra'sXMLCdonotallowthistypeofinlinecoding.Instead,thesetechnologiestakeapuremarkuplanguagepageasinput,andgenerateJavamethods.Thisessentiallyischangingtheprogramflow;insteadofthepage(JSPtechnology)callinglogicfromtheapplication,theapplication(Enhydra)usesmethodstoaffectthevaluesofthepage.InthespecificcaseofEnhydra,XMLCconvertsthepageintoaDOMtree,andusestheDOM'sHTMLbindingtoallow"fields"inthepagetobeupdated.ThepointhereisthatmoresothanXMLC,JSPtechnologycanachieveitsgoals,byonlyallowingtaglibraries,forexample.ButthegeneraltendencyinSunspecificationsistoalwaysmaintainbackwardcompatibility,oratleastmaintainitforquitealongtime.ThecurrentversionoftheJSPspec,1.1,allowsscriptlets,soexpecttoseecodeallowedinJSPpagesforseveralyearstocome.BeforedivingintoJSPcoding,becarefuloftheratherlargeholethatliesbetweenitsideal,acompleteseparationofcontentandpresentation,andwhatitactuallyprovides,whichisatbestapseudo-splitbetweenyouruserinterfaceandthecodethatdrivesyourapplication.Single-processingvs.multi-taskingIdeally,asdiscussedabove,adesigneroughttobeabletoperformasingleprocess,workingpurelyongraphicdesign,andadevelopershouldbeabletofocuspurelyoncoding.Sothedesignershouldbeabletoworkonapageafterithasbeenconvertedtoanapplication-suitableformat.InthecaseofaJSPpage,thatwouldbeafterJavaBeanshavebeenimported,inlinecodinghasbeeninserted,andcustomtaglibrarieshavebeenaddedtothepage.TheproblemisthatsomedesignersuseHTMLeditors,suchasHoTMetaL,MacromediaDreamweaver,orFrontPage,thatdonotrecognizecodescriptletsortaglibraries,whichmeansthedesignereffectivelyreceivesonlyapartialpage.Imaginethedifficultieswhentaglibrariesorcodefragmentsgeneraterowsofatable,orotherformattingdetailsforthepage.DesignersusingtheincompatibleHTMLeditorscan'tseewhatthoseelementslooklike.Whendesignerscan'teasilyrevisepagesafterdevelopersfinishcodingthem,insteadofclarifyingdistinctroles,JSPcodingcancausethemtomerge:adevelopermustmultitask,becomingdeveloper,designer,andmore.Unconvincedabouttheimportanceofthisfeature?ThendownloadtheJ2EEReferenceImplementationandloadoneoftheincludedJSPpagesintoaWYSIWYGHTMLeditor,suchasDreamweaver.Thepageimmediatelyfillswithyellowareaslettingyouknowaboutallthe"illegal"markupcontainedwithinthepage.Ofcourse,theyellowresultsfromtheJSPtagsandcode,ratherthananyrealerrorinthepage.Todate,noJSP-capableWYSIWYGeditorsexist,andIhavenotheardofanyeffortstobuildone.Whiletemplateengineshavethissameproblem,manyJava-basedsolutions,suchasmyfavorite,Enhydra,allowyoutosupplythemarkuppageasinputtothepresentationtechnology.Inthiscase,thedesignercanmakechangesasoftenasneededandresupplythemarkuppage.Runningtheengineorcompilerforthepresentationtechnologyconvertsittotheproperformat,andnocodechangeshavetobemade(inthetypicalcase).Theresultisthedesiredone:designersremaindesigners,anddevelopersremaindevelopers.So,bewaryofthepromiseofJSPtechnologyascomparedtotherealityofwhatitdelivers.Inpractice,tofunctioninaJSPtechnology-drivenenvironmentyoumusteitherhaveyourdevelopershandlealargeportionofthemarkuporhavedesignerslearnatleastsomeJSPcoding.HTMLvs.XMLOneofthemostsignificantdisadvantagesofJSPtechnology,andoneofthemostoverlooked,isitsincompatibilitywithXML.Moreprecisely,andparticularlyintheHTMLrealm,JSPpagesarenotrequiredtobeXHTML-compatible.XHTMLisaWorldWideWebConsortium(W3C)specificationthatisnowreplacingHTML4.0.XHTMLdefinestheHTMLtagsetintermsofawell-formedXMLdocument.Forexample,the<br>tagmustbeconvertedto<br/>toensureXMLcompliance.Similarrulesareappliedtoimagetags,andinXHTML1.1(recentlycomingofage)mostfontpropertiesandotherstylingmoveintoCSSstylesheets.Still,moststandardHTMLdocumentsconverteasilytoXHTML1.0,whichmeanstheycanbereaddirectlywithanyXML-compliantparser,suchasApacheXerces,andmanipulatedasXML."What'sthebigdeal?"youask.ThebigdealisthatXMLquicklyisbecomingtheglobalstandardforinter-andintra-applicationcommunication.PassingdataaroundinanXMLformatletsanyotherapplicationthatemploysbasicXMLdata-handlingfacilitiesuseyourapplication'sdataeasily.Imaginebeingabletocommunicatewithcreditcardcompaniesfore-commercesimplybymovingyourdataintoanXMLformat!Manytimes,yourpresentationofdataneedstob
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 节能环保厂房抵押借款合同模板
- 车牌照租赁代理合作协议模板
- 旅游产业项目参股合作框架合同
- 旅游代理合作协议范本:旅行社代理服务合同
- 中考 红岩 试题及答案
- 中医养生馆合同协议书
- 剧院票务开发方案(3篇)
- 草坪绿化养护合同协议书
- 两会工作报告
- 小学生学业规划班会课件
- 门店卫生管理制度
- 山西省卫生院社区卫生服务中心信息名单目录
- 工程量核定单格式
- 西方经济学章节练习题题库及答案1-16章(全)
- 全国交通运输行业“捷安杯”城市轨道交通服务员(职业组)职业技能竞赛题库及答案
- 电动车充电突发事件应急预案演练记录
- 办公室主任培训[1]ppt课件
- 射阳汉鼎新能源科技有限公司分布式光伏并网发电项目电站运维合同
- 护理查房胎盘早剥
- 分部开工申请表
- 肺炎住院病历及病程记录教学文案
评论
0/150
提交评论