(Transfer) Master the JSP custom label: (1)

zhaozj2021-02-16  90

Presentation

Page 1 (3 pages of)

Want to add a custom tag in the JavaServer Pages (JSP) application? This tutorial will show you how to use these tags similar to JSP technology combo operations - such as JSP: UseBean, JSP: GetProperty and JSP: Forward --defined custom operations. Describe how to extend the JSP syntax with a custom operation of a representation logic specific to a self-specific domain. The ability to add custom labels in the JSP application allows you to focus on your work in a document-centered development method. You can make the Java code in the JSP page, making these pages easier to maintain. (I have learned from experience in the experience, when excessive Java code is placed in the JSP page, the code maintenance will become a terrible task). This tutorial will allow you to immediately develop a self-defined label. Understand the benefits of JSP custom label development, you may feel unexpectedly for programmers without using it more. In this tutorial, I will discuss the basic content of the custom label. How to create reusable representations with custom labels and avoid jet Java scripTlets on JSP pages. In this tutorial, we will:

Define a JSP custom label architecture. Explain a simple label. Define nested labels. Explain the label with a bodycontent. Add attributes in the tag. Add scripTlet variables to the tag. Use a custom label to implement the control process. Simplify the label deployment with Struts.

Do I have to learn this tutorial?

Page 2 (3 pages a total)

If you have found yourself in the JSP application, this tutorial is to prepare for you. After reading this tutorial, you will master the information you need from the JAVA code from the JSP page. This tutorial assumes readers familiar with the Java platform, JavaServer Pages (JSP) technology, MVC mode, Reflection API, Model 2, preferably there is a Struts framework. In addition, you have to get the biggest gain from this tutorial, and you need a good experience in using the label library.

About author

Page 3 (3 pages a total)

Rick Hightower is a J2EE developer and consultant, he is keen to use J2EE, Ant, Hibernate, Struts, IMB ETTK and XDoclet. Rick is the former CTO of Trivera Technologies, which is a global training, guidance, and consulting firm, focusing on enterprise development. He often published an article on IBM DeveloperWorks and wrote more than 10 developerWorks tutorials, and content from EJB technology to Web service to XDoclet. Rick has brought another company with others to start with others, which specializes in the development, consultation and guidance of Struts / JavaServer Faces. When working for EBLOX, the Rick and EBLOX team have built two frameworks and an ASP (application service provider) for e-commerce sites before the version of the EBLOX. This framework is currently supporting more than 2,000 online store stores. Rick has completed a book named Professional Jakarta Struts. Consulting J2EE and STRUTS projects in Tour, or published in the conference, Rick likes to drink coffee in all night coffee shops, writing some articles about struts, j2ee and other content. And the third person is described with himself. Label handler

Page 1 (2 pages of)

You need to create a label handler before creating a custom label. The label handler is a Java object that performs custom lables. When using a custom label, you want to import a tag library - a set of tag / tag handler pairs. Import it in the Web Deployment Descriptor, then import it into the JSP page with the instruction taglib. If the JSP container encounters a custom label in the conversion, it checks the Tag Library Descriptor (TLD) file to query the corresponding label handler. The TLD file is like a Web deployment descriptor like a WEB deployment descriptor. At runtime, the servlet generated by the JSP page gets an instance of the label handler of the label used in this page. The generated servlet initializes the label handler with the attribute passed to it. The label handler implements the survival cycle method. The generated servlet uses these methods to notify the label handler to start, stop, or repeat custom label operations. The generated servlet calls these survival cycle methods to perform the label function.

Type of label

Page 2 (2 pages of 2)

Two types of tags can be defined:

Javax.Servlet.jsp.tagext.tag javax.servlet.jsp.tagext.bodytag is operated on the body - that is, the -cumber that operates on the content between the start and end tags must implement the BodyTag interface. In this tutorial, we will call these labels as a body label. We will not be called a simple label for labels for its body operation. Simple tags can implement TAG interfaces, although they do not require them. To remember that the label that does not operate its body is still text, but its label handler cannot read this body.

转载请注明原文地址:https://www.9cbs.com/read-11716.html

New Post(0)