Why do we have selected as their main JSP server-side application programming tool?, Of course, JSP many attractive features and functionality, but the JSP tag library is to allow me to make this decision one of the most important causes.
銆??涓轰粈涔堣繖鏍疯鍛?鍘熷洜鏈変袱涓細缁存姢鍜屽紑鍙戦?搴︺? Server-side scripting language is the development of Internet in fact is like a furnace. In a server page, you can easily mix different script methods and objects. This Web page is simply a concrete building. It is this "material" to the server-side script mixed powerful information processing capabilities. It allows server-side programmers to develop dynamic, flexible Web page. However, on the other hand, the script is difficult to defend freedom of mixing, especially with the growing size of the project which is especially serious. We will have to allow experienced programmers to create and maintain the final product, the results allow the programmer to become a general Web designers.鏈嶅姟鍣ㄧ搴旂敤绋嬪簭鍦ㄦ渶缁堢殑鍥惧舰璁捐鍜屽疄鐜拌繖涓ゆ柟闈笂灏卞急鍖栦簡銆?Worse, because these pages have become very complicated in terms of code, development rate was correspondingly lower. Finally, many medium-sized or large-scale server-side Web applications to be introduced late and can not control costs.姝ゅ锛屽湪瀹炵幇浜嗚繖浜涘簲鐢ㄧ▼搴忎箣鍚庯紝璁稿閿?敭鍟嗚繕蹇呴』鍘诲鎵惧悎鏍肩殑绋嬪簭鍛樻潵缁存姢杩欑涔卞緱濡傚悓涓?泦鎰忓ぇ鍒╅潰鏉′技鐨勪唬鐮併?
銆??鎴戜滑璋侀兘涓嶆効鎰忕湅鍒拌繖鏍风殑缁撴灉锛屾墍浠ワ紝涓轰簡鍏嬫湇杩欎釜闂锛孉SP寮曡繘浜咰OM瀵硅薄鎶?湳锛岃?JSP鍒欐彁渚涗簡J2EE浣滀负瀵圭瓥銆傝繖浜涜В鍐虫柟妗堥兘鏄缓绔嬪湪闆嗕腑鐨勩?鍙噸鐢ㄤ唬鐮佸簱鐨勬満鍒朵箣涓娿? However, they may too difficult to use, there are many time-consuming. Moreover, these solutions do not reduce the temptation to establish confusing code, the result, we can only organize large-scale internal structure of a good team to use these technologies. This means that, although we now have to establish large-scale projects with the above method, medium-sized projects are not patronize these technologies.
The reality is that medium-scale Web application project is the main part. Therefore, many projects have to face the development and maintenance of the environment can not meet their needs situation.
Fortunately, JSP provides us with the best solution to solve this problem, tag library (Tag libraries) provides a reusable block of code to establish a simple way. However, COM and J2EE, and different is that you do not need any additional skills to master can create a tag library: If you will write JSP pages, you will build tag library. Finally, the tag library also improved Web application maintenance. This improvement on the performance of maintenance at: JSP pages easily on the realization of XML-based interfaces can be customized. The results can be imagined, Web designers can create JSP Web application without having to know how the matter JSP. As a result, Web development has become a very rich and efficient team development task. JSP programmers can create custom labels and back-end code module, and Web designers can use custom labels, and full focus on Web design itself. Tag library to solve the problem of code confusion, and doing clean and beautiful (in fact, XML is the essence of solving these problems, but the tag library is still played a key role).
What is a Tag Library?
JSP tag library (also known as custom tags) is a JavaBean generated by XML-based scripting approach. From the conceptual, the label is very simple and reusable code structure. For example, in our latest release JSPKit (within the JSP Insider), we realized the use of XML tags for easy access to XML documents. Look at the list of A.
List A: implementation of XML / XSL transformation and where the sample HTML page tag
c: / xml / example.xml
c: / xml / example.xsl
The above example uses a simple label to access the code at the behind the scenes more powerful. In the above example, first load a XML file, and then apply an XSL file to create a will be sent to the client's results?? It all, but merely used a very simple label.
JSP custom tag makes it easy to create a reuse project, the open source modules. And you all need is the tag library and its documentation, however. Important features tag library as follows:
Easy to install on multiple projects
Label is easy to migrate from a JSP project to other projects. Once a tag library, you just need that one tag library packaged into a JAR file can be in other JSP project to re-use. You can not reuse the label as a programmer in the establishment of the added labels. Because the tags can be re-used, so tag library can be easily used for your own project. Currently, the best label resources can be found in JSPTags.com this site. .
JSP tag library extension
JSP tag library can have the standard (JSP 1.2) in any of the features and functionality. This also means you have unlimited ability to expand and increase the power of JSP is no need to wait for the release of new version of the JSP. So, you can cancel the JSP include page called?? Just include labels to establish their own specifications on it.
銆??鏄撲簬缁存姢
Tag library allows JSP Web application becomes very easy to maintain.涓昏鏈変互涓嬪嚑涓師鍥狅細
Tags are easy for anyone to use, easy to understand.
All your logic resides at the center of the label in the processor and JavaBean within. This way, if you have to update your code, you only need to deal with these centers to use these files without the need to amend the code of other pages.
If you need to add new functionality, you do not change any existing page.浣犲彲浠ユ妸棰濆鐨勫睘鎬у寘鍚埌浣犵殑鏍囩鍐呬粠鑰屽紩杩涙柊鐨勮涓哄悓鏃朵繚鐣欎互鍓嶇殑灞炴?锛屽疄鐜版棫椤甸潰鐨勬甯歌繍琛屻?
For example, you may have the following label, it lets you display text in blue:
銆??My Text浣嗘槸闅忕潃椤圭洰鐨勮繘琛岋紝浣犲張鎯宠钃濊壊鍙樻殫銆?So you keep your own label, but for the addition of a new property: shade
銆??My Text鎵?湁鐨勮?鏍囩缁х画鏄剧ず钃濊壊锛屼絾鐜板湪浣犲彲浠ヤ娇鐢ㄥ悓涓?爣绛炬潵浜х敓鍙樻殫鐨勮摑鑹叉枃鏈簡銆?br />
Tags enhanced code reusability. After several tests and use that code certainly has less bug. Thus, JSP pages using custom tags also have fewer defects, more convenient to maintain up naturally.
Faster development
Tag library is a good way to reuse code. We know that the server-side language standard way to reuse code is to use the template. Tag library and template library is much better than this way. Using template library, you need to modify the templates for each project or create stiff interface. Tag library is no such restriction, and its object-oriented features with the tag library is to expand not only the ability to use flexible and extremely powerful. Also, because you reuse code, resulting in project development time spent significantly reduced, while more time can be used to design their own Web applications. The simple interface makes the tag library code to use these simple and easy to debug.
While the simple tag library to use them in particular, but to establish its level of internal support for the establishment of a simple JavaBean than more complicated. This complexity is largely due to tag library contains several parts. The skills you need to understand, but is familiar with Java and JSP.
Custom labels inside
A simple custom JSP tag includes the following elements:
JavaBean: In order to take full advantage of Java object-oriented features, reuse the code should be placed in a separate container code. The JavaBean is not part of the pool tag. They are tag library used to perform the tasks assigned based code modules.
Tag handler: This is the real core tag library. Tag handler (tag handler) it requires no external reference material (JavaBean) and JSP pages for access to information (PageContext object). The JSP page, the page put the tag attribute set passed to the label processor, JSP page, the contents of the label is marked such a treatment.褰撴爣绛惧鐞嗗櫒瀹屾垚鍏跺鐞嗚繃绋嬶紝瀹冨氨浼氭妸澶勭悊鍚庣殑杈撳嚭缁撴灉鍥為?缁橨SP椤甸潰鍋氳繘涓?澶勭悊銆?br />
Tag library descriptor (TLD file): This is a very simple XML files, TLD files to describe and explain the properties, information and labeling processor file location and other information. JSP container uses this file to map the tag library called the location and usage.
Web site of the web.xml file: In fact, this is your Web site initialization file. In this document, you can define Web application using custom tags, you can also define custom labels used to describe each TLD file.
銆??鍙戝竷鏂囦欢(WAR鎴朖AR鏂囦欢)锛氬鏋滀綘鎵撶畻閲嶇敤瀹氬埗鏍囩锛岄偅涔堜綘鑲畾闇?鎯充釜绠?究鐨勫姙娉曟妸鏍囩浠庝竴涓」鐩縼绉诲埌鍏朵粬椤圭洰涓幓銆?The tag library packaged into a JAR file that is such a convenient and efficient way tag library released.鎴戜滑鍦ㄤ互涓婄殑浜嬩緥涓病鏈夊缓绔婮AR鏂囦欢锛屼絾鏄鏋滀綘鎵撶畻鏇磋繘涓?鍦颁簡瑙AR鏂囦欢鐨勭粏鑺傦紝浣犱笉濡ㄩ槄璇烩?JSP WAR鏂囦欢绠?粙鈥濄?
相关链接:
how to convert avi to wmvLenogo iPod to PC Transfer build 01Avi to 3gpYoutube Movie to Mobile Phone UtilityNews about Converters And OptimizersHTML Component (HTML COMPONENTS) one of theIssuing 3G licenses will be postponed to THE end of 2007Bluesea VCD SVCD DAT ConversionYoutube FLV TO Laptops DeluxeEvaluation Password Managersfree flv to MP4 converterFun Dreamweaver 8.0 of paragraph formatting settingsX-Cloner DVD to Apple TVMatroska video filePremier Log Analysers