If you run the example above, you will find the output from the "System.out.println" server log. This is a convenient way to do simple debugging (some servers also have technical debugging JSP technology in the IDE.) View your server's files to see if it provides such a technology. )
According to itself is a scriptlet will not produce HTML. If scriptlet is to produce HTML, it can use a variable called "Go". This variable does not need to be announced. It has been in advance for scriptlets, plus some other variables. The following example shows how scriptlet can produce HTML output.
<HTML>
<BODY>
<%
This scriptlet declares and initializes "date"
SYSTEM.OUT.PRINTLN ("Evaluating date Now");
Java.util.Date Date = new Java.util.Date ();
%>
Hello! Www.111cn.net
<%
This scriptlet generates HTML output
Out.println (string.valueof (date));
%>
Here, instead of using an expression, we are creating the HTML directly to print the "Go" variables. In the "Go" variable type Javax.servlet.jsp.JspWriter.
Another very useful predefined variable is "request". This is the type Javax.servlet.http.HttpServletRequest
"Requirements" on server-side processing means the browser and server between transactions. When someone clicks or enters a URL, the browser sends a "please" to the server and displays the returned data. As part of this work "requirements", various data, including file browsers want from the server, if the request is coming from an urgent submit button, the information of the user has entered the form field.
The JSP's "request" variable is used to obtain information from the requesting browser. For example, you can find the name of the client host (if any, otherwise the IP address will be refunded.) Let's modify the code as shown:
<HTML>
<BODY>
<%
This scriptlet declares and initializes "date"
SYSTEM.OUT.PRINTLN ("Evaluating date Now");
Java.util.Date Date = new Java.util.Date ();
%>
Hello! The time is now www.111cn.net
<%
OUT.PRINTLN (date);
OUT.PRINTLN ("<br>your machine ' s address is");
Out.println (Request.getremotehost ());
%>
</BODY>
</HTML>
A similar variable is "reaction". This can be used to influence the response being sent to the browser. For example, you can call Response.sendredirect (Anotherurl), send a response to a browser, and it should load a different URL. This reaction will actually go all the way down the browser. The browser will issue different requirements to "Anotherurl". This is a different from some of the other JSP mechanisms that we will encounter because it includes another page or a forwarded browser to another page.
Practice: Write JSP technology to the output of the entire route, "Hello!" Now is the time ... "But use Scriptlet full string, which includes HTML tags