Which three of the following is part of the Tag Library Descriptor element?
C. tag handler class
D. tag attributes
Which two of the following attributes are not part of the taglib directive?
Which file does the following DTD element definition apply to: ?
Which of the following is the Web Deployment Descriptor, the purpose of which is to configure a Web application?
Which three of the following files is part of a simple tag library?
How do you declare a tag library within a JSP page?
A. You use a declare scriptlet.
B. You use a taglib directive.
C. You use a unique variable.
D. You use the path to the tag handler.
Which two of the following options apply to an empty custom tag?
A. Specified in the web.xml Web component descriptor.
B. Specified in the tag library handler.
C. < libraryPrefix : handlerName / >
D. A custom tag with no body.
What does the container use to validate a custom tag in a JSP page?
D. Tag Library Descriptor
Which interface does the doStartTag() belong to?
What does the container do during translation when it encounters a custom tag in a JSP page?
A. It converts the XML notation into Java calls, inserted into the Java that resulted from the page translation.
B. It passes it to the tag handler.
C. It converts it to scriptlets.
D. It adds the code to the output stream.
B, C, and D. All of these are part of the Tag Library Descriptor element except option A. Also, you need a JSP file such as yourJSP.jsp.
A and D. The taglib directive only takes two attributes, uri and prefix.
D. The taglib element is used to describe a JSP tag library. The syntax for the taglib element in the web.xml file is < ! ELEMENT taglib (taglib-uri, taglib-location) >. The required taglib-location element contains the location and the taglib-uri element describes a URI identifying a Tag Library used in the Web application. You use the URI to give a tag library a unique address or namespace.
A. The web.xml file is used as the deployment descriptor. The deployment descriptor defines the elements and configuration information of a Web application. In it you define elements to support the Web application within a servlet container, including ServletContext init parameters, session configuration, and servlet declarations..”
Note: We will be covering Deployment & Deployment Descriptions shortly. So for now, just know this about the web.xml file.
A, C, and D. All of these files could be used as part of your tag library except option B because web.init is not a file defined by the specification. Also, you need a JSP file such as yourJSP.jsp.
B. The taglib directive creates a reference to the prefix. The prefix tells the container which library you want. Once that is done, you can use a custom tag, so called because it is your tag, not a standard one that came shipped with the container.
C and D. C uses correct XML notation to refer to an empty tag. By convention, we call a custom tag in a JSP page without a body an empty custom tag.
D. The Tag Library Descriptor (TLD) is used by a Web container to validate the tags in a JSP page.
A. Your tag handler is a class that extends the TagSupport abstract class if it has doStartTag() and doEndTag() methods.
A. The container will combine the JSP code and tag library into one Java source file. The container converts your custom tags into Java calls during the JSP page translation.
Previous Chapter: Quick Recap - Chapters 44 & 45
Next chapter: chapter 46 - JSP API
© 2013 by www.inheritingjava.blogspot.com. All rights reserved. No part of this blog or its contents may be reproduced or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission of the Author.