Offshore web hosting - JavaSercer Pages To control where the information is

JavaSercer Pages To control where the information is written, pass a debug parameter with the request for the page with the bean. This parameter must have one or more of the following values (separated by plus signs): resp Include the debug information in the response as an HTML table stdout Write the debug information to System.out log Write the debug information to the application log file Let’s look at an example. The JSP page shown in Example 7.8 creates an instance of the DebugBean using a action. It also sets the mandatory pageContext property using a nested action. The uses a request-time attribute value to assign the pageContext property a reference to the implicit pageContext variable. Example 7.8. Page with the DebugBean (debug.jsp) <%@ page language="java" contentType="text/html" %> <%@ page import="java.util.*" %> A scriptlet is used to set two request attributes, referred to in JSP as placing objects in the request scope . Objects placed in the request scope can be accessed by all JSP pages used to process the same request. Don’t worry about how this works now; you’ll learn more about all the JSP scopes in Chapter 8. Here, it’s only used to show you how the DebugBean displays scope information. Next, five actions are used to display the headers, cookies, parameters, requestScope, and elapsedTime properties. The DebugBean returns its property values only if the request contains a debug parameter with a valid value. Therefore, you can keep the bean in your pages all the time and activate it only when you need the debug info. If you request the page with the URL: http://localhost:8080/ora/ch7/debug.jsp?debug=resp+stdout&a=b page 82

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


Comments are closed.