JavaSercer Pages Another optional element is . It (Buy webspace)

JavaSercer Pages Another optional element is . It can contain one of three values. A value of empty means that the action body must be empty. If the body can contain JSP elements, such as standard or custom actions or scripting elements, the JSP value should be used. All JSP elements in the body are processed, and the result is handled as specified by the tag handler (i.e., processed by the tag handler or sent through to the response body). This is also the default value, in case you omit the element. The third alternative is tagdependent. This value means that possible JSP elements in the body are not processed. Typically, this value is used when the body is processed by the tag handler and the content may contain characters that could be confused with JSP elements, for example, SELECT * FROM MyTable WHERE Name LIKE ‘<%>‘. If a tag that expects this kind of body content is declared as JSP, the <%> is likely to confuse the JSP container. The tagdependent value can be used to avoid this risk for confusion. The element can optionally be used to describe the purpose of the action. The element must also contain an element for each action attribute. Each element in turn contains other elements that describe the attribute: , , and . The mandatory element contains the attribute name. The optional element tells if the attribute is required or not. The values true, false, yes, and no are valid, with false being the default. Finally, the element is an optional element that can have the same values as the element. If the value is true or yes, a request-time attribute expression can be used to specify the attribute value, for instance ‘attr=”<%= request.getParameter("par") %>‘. The default value is false. 16.8 Validating Syntax The TLD for a tag library contains information about the attributes each action element supports. Therefore, the JSP container can help by verifying that the custom action is used correctly by the page author, at least with respect to the attributes. When the JSP container converts a JSP page to a servlet, it compares each custom action element to the specification of the action element in the TLD. First, it makes sure that the action name matches the name of an action specified in the TLD corresponding to the action element’s prefix. It then looks at the attribute list in the page and compares it to the attribute specification in the TLD. If a required attribute is missing, or an attribute is used in the page but not specified in the TLD, it reports it as an error so the page author can correct the mistake. But for some actions, it’s not that simple. Some attributes may depend on the presence of other attributes. Attributes may be mutually exclusive, so that if one is used, the other must not be used. Or an optional attribute may require that another optional attribute is used as well. To be able to verify these kinds of dependencies, the JSP container asks the tag handler’s TagExtraInfo subclass for assistance. After the JSP container has checked everything it can on its own, it looks for a TagExtraInfo subclass, defined by the element, for the action. If one is defined, it puts all attribute information in an instance of the TagData class and calls the TagExtraInfo isValid( ) method: public boolean isValid(TagData data) { // Mutually exclusive attributes if (data.getAttribute(”attr1″) != null && data.getAttribute(”attr2″ != null) { return false; } // Dependent optional attributes if (data.getAttribute(”attr3″) != null && data.getAttribute(”attr4″ == null) { return false; } return true; } A TagExtraInfo subclass can use the TagData instance to verify that all attribute dependencies are okay, as in this example. In JSP 1.1, unfortunately, there’s no way to generate an appropriate error message; the method can only return false to indicate that something is not quite right. This will hopefully be rectified in a future version of JSP. page 231
Note: If you are looking for best hosting provider to host and run your tomcat application check Astra tomcat hosting services

Comments are closed.