JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
| |
(Continued from antecedent part...)
Here is the output:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sat, 19 Nov 2005 02:28:32 GMT
Content-Type: text/xml;charset=utf-8
X-Powered-
Content-Length: 38
Version: 2005
Key-Word: PHP
Key-Word: HTTP
<html><body>Hello world!</body></html>
Okay. What can we say about the output?
- I was able to alarm header() afterwards I started to achievement the article body, because I had the achievement absorber angry on.
I entered "output_buffering = 4096" in php.ini.
- "Content-Type" authentic ok.
- "Content-Length" authentic ok. But it was outputted afterwards "X-Powered-By". Not abiding why.
- The "replace" banderole worked. There is alone one "Version", because by absence alter is angry on.
There are two "Key-Word", because I set "replace" to "false" in my additional header() call.
Forcing the Browser to Redirect
The certificate says we can use header("Location: ...") to acquaint the browser to create a new HTTP appeal to
a accustomed URL. This is alleged "redirect". Actuality is my testing script, HttpRedirect.php:
<?php #HttpRedirect.php
# Absorb (c) 2005 by Dr. Yang, http://www.yang.com/
#
$text = "<html><body>Moved!</body></html>";
print($text);
header("Content-Type: text/xml;charset=utf-8");
header("Content-Length: ".strlen($text));
header("Location: http://www.yang.com/");
?>
The output:
HTTP/1.1 302 Item Moved
Server: Microsoft-IIS/5.1
Date: Sat, 19 Nov 2005 03:46:58 GMT
Content-Type: text/html
X-Powered-
Content-Length: 32
Location: http://www.yang.com/
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This certificate may be
begin <a HREF="http://www.yang.com/">here</a></body>
I am a little bit afraid by the output:
- My article physique has been absolutely replaced by a abbreviate HTML certificate generated
by the PHP engine. This is not mentioned in the PHP affidavit at all!
- The cachet band did change to "HTTP/1.1 302 Item Moved".
- The "Content-Length" still had my value, the amount of bytes of my aboriginal HTML message,
not the replacing message.
(Continued on next part...)
l version="1.0"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<!-- SetHeaderRevised.jsp
Absorb (c) 2002 by Dr. Yang
-->
<jsp:scriptlet><![CDATA[
response.setContentType("text/html;charset=UTF-8");
Cord argument = "<html><body>Hello world!</body></html>";
response.setContentLength(text.length());
response.setDateHeader("Last-Modified", System.currentTimeMillis());
response.setHeader("Author", " Yang");
out.print(text);
]]></jsp:scriptlet>
</jsp:root>
(Continued on next part...)
|
header, output, response, length, content, document, version, object, powered, continued, charset, replace, , < body, < html, www yang, yang com, < jsp, http www, content length, charset utf, type text, html <, response header lines, gmtcontent type text, < body hello, http response header, controlling http response, tutorials tutorial notes, tutorial notes controlling, notes controlling http, jstl tutorials tutorial, |
Also see ...
i(Continued from antecedent part...)/iGenerating Non HTML Article BodySometimes, you may wish to forward aback advice in the article physique that are not in the HTML
i(Continued from antecedent part...)/iSending Files for DownloadingIn the antecedent section, the requested book is delivered to the browser for aperture immediately. p
This affiliate describes:What is a session.How use affair in a PHP script.A affair analysis with 3 scripts.How affair ID can be managed after
i(Continued from antecedent part...)/iSessionPage2.php: <?php SessionPage2.php Absorb (c) 2002 by Dr. Yang session_start(); $quantity = $_SESSION; $pr
i(Continued from antecedent part...)/iHere is my sample Perl program, reg_client.pl, advised to plan with my antecedent JSP allotment application: reg_client.pl Absorb (c) 20
What is a Custom Tag?Custom Tag is an activity tag authentic by the user through the JSP tag addendum facility. It can be acclimated to move JSP page assembly logics and advi
i(Continued from antecedent part...)/i3. Autograph the tag library descriptor (tld) file. Now, I charge to ascertain a tag in a tag librarydescriptor book to use the tag class. Actuality is my first tld file, HyT
Tag Aspect Setter MethodThe JSP tag addendum ability maps anniversary aspect encountered in a customtag to an acreage of the aforementioned name of the tag object. So if you wish b
i(Continued from antecedent part...)/iTag Aspect Amount Blazon ConversionIn my antecedent example, the aspect amount is anesthetized to the tag item propertyas a cord
i(Continued from antecedent part...)/iThe JSP file: <?xml version="1.0"?<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jstl/core"