javaserver pages (jsp) technology originated more than four years ago as a powerful way to dynamically generate html on the server side. over time, and with the input of the developer community, jsp technology has evolved and matured, keeping simplicity at the forefront. the next generation of jsp technology, version 2.0, will be released with j2ee 1.4 and represents an easy-to-use, robust, and extensible technology for building web applications, well suited toward generating dynamic web content in such formats as html, dhtml, xhtml, svg, and xml.
the jsp 2.0 specification introduces many new features, including a simple yet flexible integrated expression language, an encapsulation mechanism called tag files, a simplified tag extension api, and a substantially improved xml syntax. lets explore some of these features and see what they mean for your web project.
the evolution of jsp technology
1. the web designers on your project need to learn the java programming language, which has a fairly steep learning curve in comparison to, say, the javascript programming language. furthermore, pages created with jsp technology ("jsp pages") with scattered pieces of code can become difficult to read and maintain. 【程序编程相关:Designing for the nt】 in its early stages, the focus of jsp technology was to enable the generation of dynamic content by embedding scriptlets (pieces of java programming language code) within html template data. programming with scriptlets can be quite flexible and powerful at times and is suitable for some types of projects. for many projects, however, such as those that follow a model/2 or mvc (model-view-controller) architecture, embedding scriptlets in the presentation layer can have several disadvantages, including: 【推荐阅读:Integrating Developm】 2. it becomes too easy to mix business logic with presentation logic, especially when working under a deadline. even well-intentioned developers working on well-designed web applications may find it tempting to introduce business logic in the presentation layer. 3. code becomes more difficult to reuse. scriptlets frequently lead to copying and pasting of code. tag extensions are often used to encapsulate and reuse such code. however, until this release of the specification, writing tag extensions has been a tedious and time-consuming process.
jsp technology has evolved in various ways that help make writing pages without inline scriptlets much more of a reality. these evolutions have come in the form of both changes to the specification and add-on technologies. the introduction of tag libraries in version 1.1 of the jsp specification allowed for jsp technology to be extended, and mvc frameworks like struts began to evolve, providing a simple way to abstract business logic from the presentation layer. after improvements to tag library support in version 1.2 of the jsp specification, the jsp standard tag library (jstl) was introduced, providing a core set of useful actions such as iteration, interna... 下一页