12pageencoding= "UTF-8"%>3456789Ten One A //Check session, get session information -Object obj = Session.getattribute ("username"); - if(obj! =NULL) the { -Out.print ("Welcome login" +obj.tostring ()); - } - Else + { -Out.print ("Session timed out, please log back in to the system"); + //jump to user interface after 3 seconds AResponse.setheader ("Refresh", "3; Url=login.jsp "); at } -%> - Main Page Face - - - in12pageencoding= "UTF-8"%>3456789Ten Login Page One A - //Destroy Session - sessio
(BFI, "JPEG", new FileOutputStream ("f:\\ex\\a.jpg"));//bfi to the canvas, write the canvas to a file JPEG to the specified file format} @Testpublic void Test2 () throws Exception{int width =100;int height=40; BufferedImage BFI =new bufferedimage (width, height, bufferedimage.type_int_rgb); Graphics G=bfi.getgraphics ();//Get the Graphics object can draw//1, set the background (white box) G.setcolor (color.white);//White Brush G.fillrecT (0, 0, width, height);//2, generate random number of stri
", "Learning map with put value");Map.put ("2", "Learning Map Traversal method");Map.put ("3", "Hello World");The first traversal method is commonly used by Map.get (key) two timesFor (String Key:map.keySet ()) {System.out.println ("Key" +key+ "value" +map.get (key));}The second traversal method uses iterator to traverse key and value through Map.entryset: (iterator traversal)Iteratorwhile (It.hasnext ()) {map.entrySystem.out.println ("Key" +entry.getkey () + "value" +entry.getvalue ());}The thi
I plan to learn the following Java technologies:
JSP/JSF
Servlet
JavaBeans
Swing
Struts
Hibernate
MySQL
JBoss
EJB
Some of these technologies have been used in development. Some of them only read the materials and have not been thoroughly studied.
My editor mainly uses eclipse
The version used in development is controlled to CVS, and the installed server software is cvsnt.
Eclipse client with CV
of a type parameter as a placeholder for the type that you specify when you use a parameterized type, as if the form parameter of the method is a placeholder for the value passed at run time.2 , generic values represent the meaningT typeE elementK KeyV value
3, Collections ClassUse the following:1. Multiple elements can be added to the collection at the same timeCollections.addall (List2, new B (4), new B (2), new B (3));2, using the binary method to find the set, (the premise set mu
CompareTo in the interface comparable () method to determine whether two objects are equal and to sort the objects in the collection according to each property condition, and can help to remove duplicates if the caller is greater than the argument return positive represents ascending, and vice versa represents descending4 , TreeSet the custom sort (Comparator )Custom sorting is achieved by creating a new class to implement the comparable method in the comparator interface to achieve the custom
method.C. If the parent class is called with a constructor method: The call must be displayed in the constructor of the subclass; Super can only invoke the direct parent method;6. Access permission characters (1) class access: public/default, public classes can be accessed in other packages;(2) Access rights of members
Access rights
Current Class
Current Package
Derived classes
Other Locations
Private
OK
The d
identifier is a reference. Point to the object inside the heap.Package Com.ray.ch14;public class Test {public static void main (string[] args) {int[] ints = new int[] {1, 2, 3}; System.out.println (INTs);}}Output:[[Email protected]The above output is actually a memory address.6. The underlying type array stores the values of the underlying type. Object arrays are stored as references to objects (memory addresses)Package Com.ray.ch14;public class Test {public static void main (string[] args) {in
general, because arrays are completely defined, type checking occurs both at the compiler and execution time, or the array itself is a holding object, and the generic container is simply checking for type safety in the compiler. But in the execution period is all object, is only half definition. Or, the generic container does not hold objects, leading to the problem shown above.Summary: In this chapter we mainly control arrays and generic containers, and observe what the type erasure poses to t
The preparation stage is the initial value of assigning the system to the variable. And the initialization stage is to assign the programmer's own value to the variable.The initialization phase is the execution process of the 1. The editor collects all assignment actions and static block merge formation The collection is determined in the order in which the code appears. and static initialization blocks can only access variables that are defined in the previous variable, for variables that are t
);Upload.setfileitemfactory (fileitemfactory);"One, set single file Max: 30M"Upload.setfilesizemax (30*1024*1024);//30m"Two, set total file size: 50M"Upload.setsizemax (50*1024*1024);3. Determine if the current form is a file upload formif (upload.ismultipartcontent (request)) {4. Convert request data to Fileitem object collection * (Fileitem represents each upload primary key)try {List5, traverse, get each upload itemfor (Fileitem item:list) {6, when the traversal to determine whether it is a n
/** Experiment 3.1* Create an object of the MyValue class MyValue* Assign a value of 10 to the Value field in the MyValue object* Use the GetValue () method to get the data for the MyValue object and print it on the screen**/public class Firstprogram{public static void Main (string[] args) {myvalue myvalue = new MyValue (); Myvalue.setvalue (10);System.out.println ("Result:" + myvalue.getvalue ());}} class Myvalue{private int value;public void setValue (int x) {value = x;} public int GetValue ()
/** Experiment 3.4* Use the rectangular class above to program statistics on several blocks of land* The user input the length and width of each piece of land, the program will output the relevant results**/importjava.util.*;p ublicclassadu{publicstaticvoidmain (String[] args) {rectanglerectangle1=newrectangle (); Rectanglerectangle2=newrectangle (); System.out.print ("inputlengthandwidthoftherectanle1:"); scannerin=newscanner (system.in); intrectangle1length=in.nextint (); Intrectangle1width=in
/**4-3* Derive a subclass for the rectangle class defined in Experiment 3: a square class. If the square operation is also to find the circumference and area* What methods does this subclass need to define in addition to the methods inherited from the parent class?* Lists all fields and methods of the square class.* Programming to check, run the written square class**/publicclassfirstprogram{publicstaticvoidmain (String[]args) {Square square1=newsquare (8); Squaresquare2=newsquare (25); System.o
/*** 7-1* The program that writes the character interface, accepts a number of positive integers entered by the user,*-1 indicates the end of the input.* Sort the input data in descending order using the sort algorithm* and print the results after each scan* The runtime uses the following different data series to observe its execution results* 1. There is only one data in the sequence* 2. Duplicate data in a sequence* 3. The data entered in the sequence is sorted in ascending order* 4. The data
/*** 7-3* Programmed to receive a number of data entered by the user, sorting them in descending order.* Again accept a number entered by the user, using the method to find the data in the sequence,* If present, outputs the number of the data in the sequence,* If there is no output, the number is not in the sequence**/importjava.util.*;p ublicclasstest{publicstaticvoidmain (String Args[]) {Scannerread=newscanner (system.in); System.out.println ("Please enter a number of integers to end with-1");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.