Q&A

Q1: What are three features of custom tags that I can use to extend my Web pages?
A1: Custom tags can access objects (such as HTTP request parameters and the page context) of the JSP page. They can cooperate and share information with each other and can be used in a hierarchical manner to implement programmable concepts, such as iteration.
Q2:What is the name of the Java package that supports the development of custom tags, and what are the two classes that are normally extended by custom tags?
A2: The custom tag package is javax.servlet.jsp.tagext, and the two super classes used for most tags are TagSupport and BodyTagSupport.
Q3:What are the five methods I can override when extending BodyTagSupport, including parameters and return type? In what order are these methods call when processing the custom tag?
A3: The BodyTagSupport methods in execution order are
  1. int doStartTag()

  2. void doInitBody()

  3. int doAfterBody()

  4. int doEndTag()

  5. void release()

Q4:What does TLD stand for and what is it used for?
A4: TLD is the Tag Library Descriptor, and it is an XML document that defines the Tag Library. The TLD is used to define the library name and version of the JSP specification to which your tags conform. It also lists every tag in your library.
Q5:What are the five XML components that are used in the custom tag <tag> entry in the TLD?
A5: The most common tags used in the <tag> entry in a TLD are
  1. <name> The tag name

  2. <tag-class> The implementing Java class

  3. <body-content> How the tag body is defined

  4. <attribute> Defines an attribute for the tag

  5. <variable> Defines a scripting variable created by the tag

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.4.174