JavaSercer Pages (Godaddy web hosting) The action inserts the value of

JavaSercer Pages The action inserts the value of the page counter for the specified scope in the response. If a counter has not been created using the action, the value -1 is displayed. These two actions are generic, so you can use them in your own pages if you want to keep track of the number of hits. The type of information shown in Tables 8-2 and 8-3 is what you should expect (or even demand!) from the custom action developer, whether it’s developed in-house or by a third party. Example 8.6 shows how our custom actions are used. Example 8.6. Page with Counter Custom Actions ( counter4.jsp) <%@ page language="java" contentType="text/html" %> <%@ taglib uri="/orataglib" prefix="ora" %>

Counter page 1

This page has been visited times by the current user in the current session, and times by all users since the counter was reset.

To see that a unique counter is maintained per page, take a look at “>Counter page 2. As described in Tables 8-2 and 8-3, both actions have a scope attribute, supporting the same scopes as the JSP standard actions: page, request, session, and application. The action finds or creates a counter for the current page in the specified scope and increments it by one, while displays the current value of the counter. Notice that you don’t have to tell the actions about the URI as you did with the beans in Example 8.5. That’s because the JSP container makes all the implicit objects, such as the request object, available to a custom action automatically. The action can therefore figure out the current URI all by itself. Another custom action, , is used to take care of the URL encoding of the link to the next page. It’s described in Table 8.4. Table 8.4, Attributes for Attribute Name Java Type Request-Time Value Accepted Description url String Yes Mandatory. Specifies the URL to encode. You can use this action element as an alternative to the scripting code used for URL encoding in Example 8.5. This action performs the same session ID encoding as the scripting code. Also, it encodes the parameters defined by nested actions (see Table 8.5) according to the syntax rules for HTTP parameters: Recall that all special characters, such as whitespace, quotes, etc., in a parameter value must be encoded. For instance, all spaces in a parameter value must be replaced with plus signs. When you use the action, it takes care of all this encoding. The encoded URL created by the action for this example looks something like this: product.jsp;jsessionid=be8d691ddb4128be0?id=3&customer=Hans+Bergsten page 100
Note: If you are looking for best hosting provider to host and run your tomcat application check Astra tomcat hosting services

Comments are closed.