【正文】
ed from presentation. Code vs. markup Second on the JSP technology39。ll find more books devoted to JSP technology than about almost any other single Java API. Before I dive into the specific problems that JSP technology presents, you need a clear understanding of what it claims to do. Content vs. presentation Above all, JSP technology is about separating content from presentation, foremost in Sun39。 at 。ve determined that a presentation technology allows a clean split between content and presentation, you should try to ensure that a minimum amount of rework is necessary in order to make presentation changes. The promise of JSP technology Now, on to the specifics of JSP coding. The promise of JSP technology is to supply the designer and developer the only presentation technology they will ever need. JSP technology is part of the J2EE platform, which is the strongest show of support Sun can give one of its Java products. To give you an idea of how prevalent this solution is, try running a search on 39。ve all been victim to marketing departments changing this or that). So now a problem arises: what do the designers change to tweak their work? The original markup language page they gave to the developer? Probably not, as that page has most likely had custom tags or code inserted (JSP pages, template engines), 東華理工大學(xué)畢業(yè)設(shè)計(jì) 外文翻譯 6 converted to a Java servlet, or changed into something totally the designer must rework the original page and resubmit this page to the developer. Then the developer has to reconvert this page to the specific format needed for use in the presentation technology. Alternatively, the designer has to learn a scripting language or at least know that which areas of the page39。s code the simplest case, the artist supplies the markup, and the developer provides code and also plugs the markup into the presentation technology. The application is started up, and the content magically bees a user interface. Of course, as we all know, development rarely ends there. Next e revisions and changes to the interface and new business rules that must be coded. This is where the true test of the presentation technology39。t have to generate data in a presentationspecific manner. Data, or content, is returned raw, without formatting. The presentation technology then applies formatting, or presentation, to this content. The result is an amalgam of data surrounded by and intertwined with graphics, formatting, colors, and at the examples in Listing 1 and Listing 2 to see at a glance the difference between raw content and content bined with presentation 1 shows raw content, with nothing but data, that could be used in a variety of ways. class=displaycodeRussell Crowe Tom Hanks Meg Ryan Mary Stuart Masterson Alec Baldwin Ashley Judd Keanu Reeves Listing 2, which is much more plex than the one above, shows the same data wrapped in presentation technology and ready for display in an HTMLcapable browser. class=displaycodeHTML HEAD TITLESearch Results: Actors/TITLE /HEAD BODY 東華理工大學(xué)畢業(yè)設(shè)計(jì) 外文翻譯 4 H2 ALIGN=centerSearch Results: Actors/H2 CENTER HR width=85% TABLE width=50% CELLPADDING=3 CELLSPACING=3 border=1 BGCOLOR=FFFFCC TR BGCOLOR=FFCCCC TH width=50% ALIGN=centerLast Name/TH TH width=50% ALIGN=centerFirst Name/TH /TR TR TD width=50%Baldwin/TD TD width=50%Alec/TD /TR TR TD width=50%Crowe/TD TD width=50%Russell/TD /TR TR TD width=50%Hanks/TD TD width=50%Tom/TD /TR TR TD width=50%Judd/TD TD width=50%Ashley/TD /TR TR TD width=50%Masterson/TD TD width=50%Mary Stuart/TD /TR TR TD width=50%Reeves/TD TD width=50%Keanu/TD /TR TR 東華理工大學(xué)畢業(yè)設(shè)計(jì) 外文翻譯 5 TD width=50%Ryan/TD TD width=50%Meg/TD /TR /TABLE /CENTER While the content in Listing 1 is clear and easy for the uninitiated layperson to both use and understand, the content in Listing 2 is very specific to the task of display in a browser. It is tricky to extract data from it or manipulate it for any other fundamental difference, the process of segregating content from presentation instead of integrating the two (at least until the user needs the information), is the basic premise of any presentation technology, including the JSP technology. Further, any presentation technology that does not acplish this basic goal does not truly acplish the goal it was created to achieve. Work vs. rework Besides the separation of content and presentation, another measure of a presentation technology39。t been as easy as we might have hoped. A number of issues creep up when it es to taking the programming languages everyone used for backend systems and leveraging them to generate markup 東華理工大學(xué)畢業(yè)設(shè)計(jì) 外文翻譯 3 language suitable for a client. With the arrival of more options on the browser (DHTML and JavaScript coding, for example), the increase in graphic artist talent in the Web domain, and tools that could create plex interfaces using standard HTML, the demand for fancy user interfaces has grown faster than our ability to develop these front ends to our applications. And this has given rise to presentation technology was designed to perform a single task: convert content, namely data without display details, into presentation meaning the various user interfaces you see on your phone, PalmPilot, or Web browser.