Computers & Technology jsp

musicappsios sportsappsios wargamesios

JSP and JSTL Tutorials - Tutorial Addendum - JSP Sessions and Debugging

 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 cookies.Where is affair data stored.What is a Session?Session: An abstruse abstraction to represent a alternation of HTTP requests and responses exchanged amid a specific Web browser and a specific Web server.Session abstraction is actual advantageous for Web based applications to canyon and allotment information from one Web page (request) to addition Web page (request). Since the accepted architecture of HTTP agreement does not abutment affair concept, all Web server ancillary scripting technologies, including PHP, accept advised theirown way to abutment affair concept. The key architecture aspect of affair abutment isabout how to analyze a affair and how to advance the affair ID (identification).One accepted way to advance the affair ID is use the cookie technology. The afterward diagram shows you how to do this: Server BrowserID created | <... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 (Continued from antecedent part...)Sending Files for DownloadingIn the antecedent section, the requested book is delivered to the browser for aperture immediately. HTTP does aswell abutment addition attack band alleged "Content-Disposition" which tells the browser to notopen the book immediately, but adapt for downloading the article body. The afterward scriptwill appearance you how to do this: <?php #GetFile.php# Absorb (c) 2005 by Dr. Yang, http://www.yang.com/# $ok = array_key_exists( QUERY_STRING , $_SERVER); if ($ok) { $p = $_SERVER[ QUERY_STRING ]; $ok = strlen($p)>0 && file_exists($p); } if ($ok) { if (strpos($p,".html")!=false) { header("Content-Type: text/html"); } abroad if (strpos($p,".gif")!=false) { header("Content-Type: image/gif"); } abroad if (strpos($p,".pdf")!=false) { header("Content-Type: application/pdf"); } abroad if (strpos($p,".doc")!=false) { header("Content-Type: application/msword"); } abroad { $ok = false; } } if ($ok) { header("Content-Length: ".... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 (Continued from antecedent part...)Generating Non-HTML Article BodySometimes, you may wish to forward aback advice in the article physique that are not in the HTML format, for example, a PDF document, or a MS Chat Document. In thiscase, we accept to set Content-Type, Content-Length and additional attack curve carefullyto accommodate actual advice about the article physique for the applicant program. Here is a sample PHP Software to appearance you how to set attack curve for altered typesof data in the article body. <?php #GetFile.php# Absorb (c) 2005 by Dr. Yang, http://www.yang.com/# $ok = array_key_exists( QUERY_STRING , $_SERVER); if ($ok) { $p = $_SERVER[ QUERY_STRING ]; $ok = strlen($p)>0 && file_exists($p); } if ($ok) { if (strpos($p,".html")!=false) { header("Content-Type: text/html"); } abroad if (strpos($p,".gif")!=false) { header("Content-Type: image/gif"); } abroad if (strpos($p,".pdf")!=false) { header("Content-Type: application/pdf"); } abroad if (strpos($p,".do... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 (Continued from antecedent part...)Here is the output: HTTP/1.1 200 OKServer: Microsoft-IIS/5.1Date: Sat, 19 Nov 2005 02:28:32 GMTContent-Type: text/xml;charset=utf-8X-Powered-Content-Length: 38Version: 2005Key-Word: PHPKey-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 RedirectThe certificate says we can use header("Location: ...") to acquaint the browser to create a new HTTP appeal to a accustomed URL. This is alleged "redire... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 (Continued from antecedent part...)2. Command: "php HttpRequestGet.php /dot.gif" gives us: HTTP/1.1 200 OKServer: Microsoft-IIS/5.1Date: Sun, 13 Nov 2005 04:40:17 GMTContent-Type: image/gifAccept-Ranges: bytesLast-Modified: Sun, 11 Aug 2002 20:48:20 GMTETag: "04237ecd343c21:c61"Content-Length: 43GIF89a......As you can see, Content-Type was set accurately to "image/gif" for book name addendum "gif", as authentic in the MIME settings. I could not cover the article physique actuality because it contains bifold data.3. Command: "php HttpRequestGet.php /hello.pdf" gives us: HTTP/1.1 200 OKServer: Microsoft-IIS/5.1Date: Sun, 13 Nov 2005 04:45:03 GMTContent-Type: application/pdfAccept-Ranges: bytesLast-Modified: Sun, 27 Jul 2003 20:22:12 GMTETag: "0b2f4c27c54c31:c61"Content-Length: 909%PDF-1.3% ...4 0 obj......Again, Content-Type was set accurately to "application/pdf" for book name extension"pdf", as authentic in the MIME settings. I truncated the article physique to save some space.Controll... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 (Continued from antecedent part...)Once the Web browser finishes processing the article body, you can get some bound informationfrom the attack lines. For example, you can bang the appropriate abrasion button and selectthe backdrop command on Internet Explorer, it will affectation some accepted propertiesabout this acknowledgment in a pop up window. The backdrop displayed are not consistently identical to the acknowledgment attack lines. The "Modified" acreage is apparently identical to the "Last-Modified" article attack line. The "Type" acreage is ancient accompanying to the "Content-Type" article attack line, and sometimes accompanying to server ancillary resourcethat generated the response.How to appearance all the attack curve accustomed in the HTTP response? I couldn t findany absolute accoutrement to do this. So I wrote the afterward program to dump the absolute response including all attack curve accustomed from a Web server: <?php # HttpRequestGet.php# Absorb (c) 2005 by Dr.... Read More by user
Tags: files, server, content, controlling, command, notes, lines, tutorial, tutorials, response

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 (Continued from antecedent part...)2. Acknowledgment attack lines: Advice about the response: Accept-Ranges Age ETag Area Proxy-Authenticate Retry-After Server Alter WWW-Authenticate3. Article attack lines: Advice about the data requested by the client: Acquiesce Content-Encoding Content-Language Content-Length Content-Location Content-MD5 Content-Range Content-Type Expires Last-Modified Controlling Attack LinesWhen a PHP page is requested, the acknowledgment attack curve will be created by thePHP engine. But you can ascendancy all attack curve with the header() function. Hereare rules and syntax of the header() function:1. The syntax of header() is: void header(string header_line[, bool replace[, int http_response_code]])2. "header_line" specifies a complete attack band cord like "Content-Type: text/html".3. "replace" can be acclimated to alter a ahead authentic attack band of the aforementioned identifier. Default is replacing. 4. "header_line" can be acclimated to set the HTTP ackno... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve

 This affiliate describes:HTTP Acknowledgment SyntaxHTTP Acknowledgment Attack LinesControlling Attack LinesViewing Attack LinesHeader Curve of Changeless FilesControlling Attack Curve - Archetype ScriptsForcing the Browser to RedirectGenerating Non-HTML Article BodySending Files for DownloadingHTTP Acknowledgment SyntaxBased on HTTP/1.1 protocol, afterwards accepting and interpreting an HTTP requestfrom a client, a server haveto responds with an HTTP acknowledgment afterward the syntaxbelow: status-lineheader-line...header-lineentity-bodyNote that:Response haveto accept one status-line.Response can accept zero, one, or some attack lines.Response can alone accept aught or one entity-body.There is a bare band amid attack curve and the article body.Status line, attack line, and bare band haveto be concluded with CRLF ("/r/n") characters.Entity physique is the absolute data requested by the applicant request.Header curve can be in any order.Below is a simple HTTP acknowledgment with two at... Read More by user
Tags: controlling, notes, lines, tutorial, tutorials, response

JSP and JSTL Tutorials - Tutorial Addendum - JSP Achievement

 (Continued from antecedent part...)Response Time of "Hello" PageThe next breadth I wish analysis is absolute acknowledgment time of ASP pages. To do this, I wrotethe afterward Java program. This program is accomplishing a individual HTTP appeal to a specifield Web page, and repeating this for some times. /** * HttpResponseTest.java * Absorb (c) 2002 by Dr. Yang. All rights reserved. */import java.io.*;import java.net.*;public chic HttpResponseTest { accessible changeless abandoned main(String[] args) { int numberOfTests = 1; if (args.length > 0) numberOfTests = Integer.valueOf(args[0]).intValue(); continued t1 = System.currentTimeMillis(); Cord aftereffect = ""; for (int nTest=1; nTest<=numberOfTests; nTest++) { aftereffect = test(args); } continued t2 = System.currentTimeMillis(); continued t = t2 - t1; PrintStream out = System.out; out.println("Performace Information:"); out.println(" Amount of tests = " + numberOfTests); out.println(" Time = " + (t/1000) + " seconds."); out.print... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - JSP Achievement

 Calculating Prime NumbersThe first breadth I wish to analysis for achievement is accumulation addition calculations. The afterward JSP page calculates prime amount starting from amount 3, and repeats the analysis some times. <?xml version="1.0"?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"><!-- PrimeNumbers.jsp Absorb (c) 2003 by Dr. Yang--><jsp:directive.page contentType="text/html"/><jsp:directive.page import="java.util.*"/><jsp:scriptlet><![CDATA[ int[] primes = new int[1000]; int numberOfTests = 100; int numberOfPrimes = 1000; continued t1 = System.currentTimeMillis(); for (int nTest=1; nTest<=numberOfTests; nTest++) { // Accepting prime numbers int nPrime = 0; int i = 2; while (nPrime < numberOfPrimes) { i = i + 1; int j = 2; boolean isPrime = true; while (j<i && isPrime) { isPrime = i % j > 0; j = j + 1; } if (isPrime) { nPrime = nPrime + 1; primes[nPrime-1] = i; } } } continued t2 = System.currentTimeMillis(); continued t... Read More by user
Tags: numbers, tests, performance, prime, notes, tutorial, tutorials

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages

 (Continued from antecedent part...)Static HTML Argument - JSP Page in XML SyntaxIn the third test, the changeless argument is amid into a JSP page in XML syntax: <?xml version="1.0" encoding="gb2312"?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jstl/core" version="1.2"> <jsp:directive.page contentType="text/html; charset=gb2312"/><!-- StaticGB2312.jsp Absorb (c) 2002 by Dr. Yang--><html><body><p>GB2312-binary: ?=(0xCBB5C3F7)<br/>GB2312-#xHEX: &#xCBB5;&#xC3F7;<br/>GB2312-uHEX: uCBB5uC3F7<br/>Unicode-binary: ----=(0x8bf4660e)<br/>Unicode-#xHEX: &#x8bf4;&#x660e;<br/>Unicode-uHEX: u8bf4u660e<br/>Unicode-UTF8: ??=(0xE8AFB4E6988E)<br/></p></body></html></jsp:root>If you appearance this page with IE, you should will see that alone Unicode-#xHEX lineis displayed correctly. This is a big supprise to me:The XML parser in Bobcat is not deconding my JSP page with gb2312.My JSP page seems to be... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages

 (Continued from antecedent part...)In adjustment to analysis out how to ascendancy those factors, I best two simplifiedChinese characters, and entered them in 7 altered formats as a simple HTML paragraph: <p>GB2312-binary: ?=(0xCBB5C3F7)<br/> GB2312-#xHEX: &#xCBB5;&#xC3F7;<br/>GB2312-uHEX: uCBB5uC3F7<br/>Unicode-binary: 明=(0x8bf4660e)<br/>Unicode-#xHEX: &#x8bf4;&#x660e;<br/>Unicode-uHEX: u8bf4u660e<br/>Unicode-UTF8: ??=(0xE8AFB4E6988E)<br/></p>Hex numbers are provided next to the bifold codes, just in case if you accept trouble to archetype this book to your bounded system.In the next 3 sections, I will put this branch into a approved HTML file, a JSP page withstandard syntax, and a JSP page with XML syntax to see how Bobcat server will catechumen theminto Java chic files and in what incodings.Static HTML Argument - HTML PageIn the first test, the changeless argument is amid into a approved HTML file: <html><!-- StaticGB2312.html ... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages

 (Continued from antecedent part...)Java Strings - Byte Sequences Encoded for Bounded LanguagesLet s try advantage 1 mentioned in the antecedent area first. Actuality is my sample JSP page: <?xml version="1.0"?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jstl/core" version="1.2"> <!-- HelpGB2312Java.jsp Absorb (c) 2002 by Dr. Yang--><jsp:directive.page contentType="text/html; charset=gb2312"/><jsp:declaration><![CDATA[ clandestine java.io.OutputStream outStream; clandestine abandoned writeGB(String s) throws Throwable { for (int i=0; i<s.length(); i++) { burn c = s.charAt(i); byte b = (byte) (c>>8 & 0x00FF); //if (b>0) outStream.write(b); b = (byte) (c & 0x00FF); outStream.write(b); } }]]></jsp:declaration><jsp:scriptlet><![CDATA[ outStream = response.getOutputStream(); writeGB("<html>"); writeGB("<meta http-equiv="Content-Type"" + " content="text/html; charset=gb2312"/>"); writeGB("<body>"); writeGB("... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages

 (Continued from antecedent part...)Let s attending at the additional allotment first to see how non ASCII characters are stored in HTML documents, transferred from Web servers to browsers, displayed on the screen. Actuality are some basal rules related to these steps:Non ASCII characters haveto be encoded in a accurate encoding schema, like GB2312, Shift-JIS, or UTF-8.You alone use a individual encoding action in one HTML document. The encoding action name should be accustomed in a meta tag as the charset value.For examples, see my sample HTML certificate in this section.Non ASCII characters can be transferred cautiously from Web servers to browsers.The browser haveto break HTML abstracts based on the action name accustomed in thedocuments - auto mode, or set by the browser user - chiral mode. Once non ASCII characters are decoded correctly, the browser haveto be providedwith chantry files that bout the appearance set in which those non ASCII characters are defined.In adjustment to ana... Read More by user
Tags: based, pages, rules, chinese, characters, browser, screen, codes, notes, document, string, tutorial, tutorials, response, entered

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages

 This affiliate explains:How characters biking from JSP files to browser screens.How ASCII characters plan in JSP pages. How to present non ASCII characters in HTML documents.How to access non ASCII charactetrs in Java strings and contole the achievement encodings. How Java cord works with byte sequences encoded for a bounded language.How Java cord works with Unicode codes - bounded accent independent.How to access non ASCII characters as changeless HTML text.How changeless HTML argument works in HTML pagesHow changeless HTML argument works in JSP pages with accepted syntax.How changeless HTML argument works in JSP pages with XML syntax.How to acknowledging characters from assorted languages.For added addendum on non ASCII codes and Java program localization, see my additional books: " s Addendum on Unicode" and " s Addendum on JDK".Characters Traveling from JSP Files to Browser ScreensHandling non ASCII characters in JSP files accurately is not an simple task. I accept apparent some le... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - JSTL - Syntax and Announcement Accent

 (Continued from antecedent part...)Do you accept any supprises if you analyze your assumption with output? I accept someexplanations on the achievement to advice you:Example 3 shows you that the aftereffect of accumulation operations is not adapted by to integer.Example 5 confirms that absent is adapted to false.Example 7 shows ycu that amount will be adapted aback to an identifier (variable name).Examples 10 and 12 appearance you two actual means of accessing item properties. Examples 11 is understandable, because an announcement is accepted in ancillary "[]"and "method" after quotes is an identifier and it matches no absolute altar (variable names). Examples 13 and 14 accept syntax errors, because the "." abettor alone takesidentifiers (names) as operands.Exampels 15 and 16 are altered means of writting nested "." operations. Exampels 24 and 25 accept syntax errors, because "0" is not accustomed an identifier.Exampels 30 and 31 acquaint us that variables declared by scriptlet are not... Read More by user
Tags: example, attributes, level, value, examples, errors, attribute, notes, tutorial, tutorials, object

JSP and JSTL Tutorials - Tutorial Addendum - JSTL - Syntax and Announcement Accent

 (Continued from antecedent part...)As you can see, this action is actual complex. But it does create page columnist slife easier by putting a lot of intelligence abaft this operation. But it alsobrings a lot of abashing if you alter the code.The JSTL blueprint about the "." and "" operators is quoted beneath as reference. But I accept my description is abundant easier to understand. The announcement accent follows ECMAScript in accumulation the analysis ofthe "." and "" operators.expr-a.identifier-b is agnate to a; that is, the identifier identifier-b is acclimated to assemble a accurate whose amount isthe identifier, and then the "" operartor is acclimated with that value.To appraise expr-a:. Appraise expr-a into value-a. if value-a is null, acknowledgment null.. Appraise expr-b into value-b. if value-b is null, acknowledgment null.. if value-a is a Map, Account or array . if value-a is a Map . if !value-a.containsKey(value-b) then acknowledgment null. . otherwise, acknowledgment valu... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - JSTL - Syntax and Announcement Accent

 (Continued from antecedent part...)The accurate data rules are simple to understand, with a brace of exceptions:No accurate data for appearance data type. String can be quoted by individual adduce ( ).Named variables are advancing from two sources:Variables authentic by the JSTL "set" action.Variables provided as attributes in the pageContext item able by additional server ancillary codes, like useBean and scriptlet JSP elements. Variables provided as pageContext attributes will accept their aboriginal Java types, like int, float, char, or Object. But all JSTL operations will be agitated out inone of the 5 types of accurate data. Operators of additional types will be convertedbefore the operation.Type about-face rules:To cord - Using the Java rules, except that absent will be adapted to "".To boolean - Using the Java rules, except that absent or "" will be adapted to false.To accumulation - Using the Java rules, except that absent or "" will be adapted to 0.To amphibian porint amount -... Read More by user
Tags: types, rules, elements, names, calling, operation, value, attribute, cookie, values, single, operators, notes, string, tutorial, tutorials, object

JSP and JSTL Tutorials - Tutorial Addendum - JSTL - Syntax and Announcement Accent

 This affiliate explains:Basics on JSTL syntax.Basics on Announcement Language.Literal data and called variables.Basic operators and operations.Accessing accumulating elements and item properties.ExpExample.jsp - Announcement examples JSP page.pageContext attributes and JSTL top akin identifiers.JSTL SyntaxJSTL syntax is actual simple. JSTL allows you to address tags in JSP pages. Each tag is infact alleged an action. Every activity haveto be accounting as an XML element.The syntax of an JSTL activity XML aspect is something like these: <p:tag attribute="text_only"/><p:tag> xml_body</p:tag><p:tag attribute="text_only"> xml_body</p:tag><p:tag attribute="${expression}"> xml_body</p:tag><p:tag attribute="text${expression}text${express}..." ...> xml_body</p:tag>As you can see, there are a amount variations in the syntax:An activity can be an abandoned or non-empty XML element.An activity can accept zero, one, or some attributes.Attribute ethics can be argument onl... Read More by user

JSP and JSTL Tutorials - Tutorial Addendum - JSTL - Amount Library

 (Continued from antecedent part...)I am not assuming you the achievement here. But it is correct. Assurance me. As you can see in the antecedent code, I am not breaking the bend on "j" when "i" has already been accustomed as a non-prime number, because I don t understand how.One of the emails I accustomed afterwards publishing the aloft addendum suggests meto admit a Java breach account through a scriptlet to breach the "forEach" tag. To try this idea, I revised my JSP page to JstlPrimeNumbersRevised.jsp: <?xml version="1.0"?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jstl/core" version="1.2"> <!-- JstlPrimeNumbersRevised.jsp - Accumulation error Absorb (c) 2004 by Dr. Yang--><jsp:directive.page contentType="text/html"/><html><body><p>Checking prime numbers:</p><c:set var="upperLimit" value="${20}"/><c:forEach var="i" begin="${3}" end="${upperLimit}"> <c:set var="isPrime" value="${true}"/> <c:forEach var="j" begin... Read More by user

 

 

Pages :  1 2 3