webjxcom Tip: 2001 Contact JSP, when the tag library, n-tier structure development, design patterns, such as Java EE thought has just sprouted, each JSP file is pure Java embedded code, JavaScript, HTML mixed, to achieve the function of the first priority. The first contact with Taglib in 2003, Jstl a little understanding of the Apache organization, but not really used in the project. With the popularity of struts, JS |
2001 Contact JSP, when the tag library, n-tier structure development, design patterns, such as Java EE thought has just sprouted, each JSP file is pure Java embedded code, JavaScript, HTML mixed, to achieve the function of the first priority. The first contact with Taglib in 2003, Jstl a little understanding of the Apache organization, but not really used in the project. With the popularity of struts, Jstl's thunder has been overshadowed, but it is said that the core of the Jstl in the tag library used a lot. This time, based on the purpose of learning, relive the implementation of the custom label. Make one of the simplest custom tags, and the effect is to print Hello world!
1, the writing label processing class Hellotag (realizes Javax.servlet.jsp.tagext.Tag Class)
Note the meaning of several constants defined in tag (eval_page,skip_body, etc.)
2. Write hellotag.tld label definition file
3. Write Test JSP file
The test result should be to print out two Hello world!
Advantages of the Tag library
1, to maximize the elimination of JSP pages embedded in Java code
2, enhance the code extensibility, readability, code reuse, simplified JSP page writing workload