two new features in jsp 2.0 deal with custom tag libraries. the first is the new javax.servlet.jsp.tagext.simpletag interface, which simplifies the life-cycle of a tag handler. the second feature simplifies the whole process of writing tag extensions entirely. the latter is a radical change, i would say. for the first time, you dont need a tag library descriptor for your custom tags. nor do you have to compile your tag handlers. now, even those who dont understand java can write custom tags. this article discusses tag files in detail. the first part of this article introduces tag files and presents a few examples. part two will deal with the more advanced aspects of tag files and will discuss the packaging of tag handlers based on tag files. the sample application that is covered in this article can be downloaded here. to run the application, you need a jsp-2.0-compliant jsp container, such as tomcat 5. you need to be familiar with jsp and tag extensions to understand this article well.
introduction to tag files 【程序编程相关:Introducing SharePoi】
tag extensions are great. they allow you to write completely script-free jsp pages, thus promoting the separation of labor: page authors and java programmers can work simultaneously, on the tasks that best suit them. however, writing custom tags is a tedious chore, involving writing and compiling a tag handler and defining a tag in the tag library descriptor. jsp 2.0 adds the javax.servlet.jsp.tagext.simpletag interface, which you can use to write simple tag handlers. however, simpletag does not make the whole process simpler. 【推荐阅读:Portal Tips and Tric】
writing and compiling a tag handler. defining the tag that is associated with the tag handler.tag files simplify the process. first, tag files dont need to be compiled. they are compiled as they are invoked. also, tag files allow tag extensions to be written using only jsp syntax. this means someone who does not know java can also write tag extensions! 【扩展信息:Orchestrating Web Se】
writing a traditional custom tag requires two steps:
... 下一页