摘要:Somehow, the Container has to get the session ID to theclient as part of the response, and the client has to send backthe session ID as part of the request. The simplest and mostcommon way to exchange...
阅读全文
摘要:MyServletContextListenerCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1packagecom.example;23importjavax.servlet.*;;45publicclassMyServletContextList...
阅读全文
摘要:Each request runs in a separate thread! When you use GET, the parameter data shows up in the browser’s input bar, right after actual URL (and separated with a “?”).Still another iss...
阅读全文
摘要:form.htmlCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1<html><body>2<h1align="center">BeerSelectionPage</h1>3<formmethod...
阅读全文
摘要:When you deploy your servlet into your web Container, you’ll create a fairly simple XML document called the Deployment Descriptor (DD) to tell the Container how to run yourservlets and JSPs. Alt...
阅读全文
摘要: A GET request appends form data to the end of the URL. A POST request includes form data in the body of the request. A MIME type tells the browser what kind of data the browser is about to ...
阅读全文
摘要:CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1importjava.util.*;23classBerylliumSphere4{5privatestaticlongcounter;6privatefinallongid=counter++...
阅读全文
摘要:Generic MethodsCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1publicclassGenericMethods{2public<T>voidf(Tx)3{4System.out.println(x.getClass()....
阅读全文
摘要:ShapesCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1importjava.util.*;23abstractclassShape4{5voiddraw()6{7System.out.println(this+".draw()");8}9abs...
阅读全文
摘要:Since String objects are immutable, you can alias to a particular String as many times as you want. Because a String is read-only, there’s no possibility that one reference will change something...
阅读全文
摘要:When you override a method, you can throw only the exceptions that have been specified in the base-class version of the method. This is a useful restriction, since it means that code that works with t...
阅读全文
摘要:So far, the foreach syntax has been primarily used with arrays, but it also works with any Collection object.
阅读全文
摘要:If you want to make an object of the inner class anywhere except from within a non-static method of the outer class, you must specify the type of that object as OuterClassName.InnerClassName, So an i...
阅读全文
摘要:The interface keyword takes the concept of abstractness one step further. The abstract keyword allows you to create one or more undefined methods in a class—you provide part of the interface wit...
阅读全文
摘要:All method binding in Java uses late binding unless the method is static or final (private methods are implicitly final). This means that ordinarily you don’t need to make any decisions about wh...
阅读全文
摘要:Java’s final keyword has slightly different meanings depending on the context, but in general it says “This cannot be changed.” You might want to prevent changes for two reasons: des...
阅读全文
摘要:The levels of access control from “most access” to “least access” are public, protected, package access (which has no keyword), and private.
阅读全文
摘要:The default behavior of equals( ) is to compare references. So unless you override equals( ) in your new class you won’t get the desired behavior. Java programmers cannot implement their own ov...
阅读全文