JavaSercer Pages The element contains the symbolic name, (Mysql webhost)

JavaSercer Pages The element contains the symbolic name, and the element contains the path to either the JAR file or the TLD file. The path typically starts with a slash (/) and is then interpreted as a context-relative path, in other words, relative to the top directory for the application. This indirection using a symbolic name that’s mapped to the real location - is especially helpful as it allows you to change the name of the tag library file for all JSP pages in one place, for instance when you upgrade to a later version of the library. For a simple application, you may feel that the indirection is overkill. If so, you can use the path to the JAR file explicitly as the uri attribute value: <%@ taglib uri="/WEB-INF/lib/orataglib_1_0.jar" prefix="ora" %> All JSP 1.1-compliant containers should be able to find the TLD file in the JAR file, but this is a recent clarification of the specification. If the container you use doesn’t support this yet (such as Tomcat 3.1), you must use the path to the TLD file instead of the path to the JAR file: <%@ taglib uri="/WEB-INF/tlds/orataglib_1_0.tld" prefix="ora" %> In both cases, the path may start with a slash and is then interpreted as a context-relative path. Without a starting slash, the path is interpreted as relative to the JSP page. The prefix attribute defines a prefix used for the actions in this library. This prefix is used as part of the custom action names, as you will soon see. If you use more than one library in a page, each must have a unique prefix. You can use any prefix you like except jsp, jspx, java, javax, servlet, sun, and sunw, which are reserved. The ora prefix is used for all custom actions in the examples in this java blog. As I mentioned earlier, a custom action is used in a JSP page just like the standard actions we’ve used so far. In other words, it has a start tag, which may contain attributes, and an end tag. It can also have a body. Let’s revisit our example from earlier: The name consists of the prefix you specified with the taglib directive, and a unique name within the library, separated by a colon (:). As with standard actions, all attribute names are case-sensitive, and the value must be enclosed in single or double quotes. Now let’s see how we can use two custom tags to improve the counter example. The attributes for the custom actions are described in Table 8.2 and Table 8.3. Table 8.2, Attributes for Attribute Name Java Type Request-Time Value Accepted Description scope String No Specifies the scope for the counter. Valid values are page, request, session, and application. Default is page. The action increments a unique counter for the page where it’s used. The counter can be placed in any of the standard JSP scopes. For instance, it can be placed in the session scope to count hits by different clients, or the application scope to count hits by all clients. The first time the action is used for a specific scope, the counter is created and set to 1. Table 8.3, Attributes for Attribute Name Java Type Request-Time Value Accepted Description scope String No Specifies the scope for the counter. Valid values are page, request, session, and application. Default is page. page 99

Hint: If you are looking for very good and affordable webspace to host and run your tomcat hosting application check Sandzak.com tomcat web hosting provider

Comments are closed.