FAQ in Java

xiaoxiao2021-03-06  124

The first school Java friend is likely to meet many problems, and some of the following is collected. Abstract - from: Java Club 1. [Ask] What is the application and applet? Is there a difference in use? [Answer] Application and Applets are two most commonly used in Java language, both of which must be run on the Java virtual machine. simply speaking,

Application is more like a desktop program written by VB, VC, etc., and is more likely to implement window applications in a console method.

The applet can be embedded in the web page and run on a browser that supports Java virtual machines. The application should be different when used. 2. [Ask] I have written a simple Application and have been compiled. I got a class file, but I reported the incorrect of the Class if I use JDK's Java command. [Answer] This is a problem that is often encountered by Java. In fact, it is very simple. Do you look at the primary class name defined in the program and the name of the program (* .java)? This error occurs if the two names are different. 3. [Ask] I want to learn Java language, but I face a lot of Java development tools, I don't know what it is? [Answer] There are currently many Java development tools, each has its own characteristics. For beginners, it is recommended to use Sun's JDK to begin learning, pay attention to the use of JDK documentation, which is very helpful for the basic skills of Hyun Java. When using Java development projects in the future, some engineered visual tools, such as Microsoft VJ , etc. In fact, JDK and other visual tools are often used in development. 4. [Ask] Will often see something like JavaScript, is it different from Java? [Answer] Compare Java, JavaScript can't be said to be a complete language. It defines a set of methods, event processing, etc., mainly used to increase the page effect in web page development, data validity check, etc. It can also be used as a programming script when developing the Microsoft ASP. It has a basic right thing that is VBScript.

Solution to common Chinese issues: 1.JDK Chinese issues: Do not use DataInputStream with DataOutputStream, and use BufferedReader with BufferedWriter.

3. Database Chinese Issues: Access JavaodBC driver cannot support Chinese (use getByte () does not work), I have not found a solution yet. The mysql javaodbc driver also has a Chinese issue, and I haven't found a solution yet. MySQL mm.mysql.jdbc does not have any Chinese issues, but builds a data sheet, there is a Chinese input domain, it is best to set it into bianry, otherwise it is regardless of case when the query is in the query because of the domain of mysql vARCHAR, CHAR, TEXT. This time, there will be a problem in such a Chinese query. 4.Jsp's Chinese issue. Chinese issues when SetPotry, you can use Urldecoder.Decode ().

How to set the environment variable of Java 2 (JDK1.2)?

A: Java 2 After installation, you need to set the path and java_home environment variables. Different from JDK1.1: After setting the Java_Home environment variable, JVM will automatically search the system class library and the user's current path. Solaris platform: setENV JAVA_HOME JAVA2 Installation path setENV PATH $ java_home / bin: $ {pat} Windows platform: set java_home = Java2 installation path set path = $ java_homebin;% PATH%

Q: Use JDBC programming, how to control the result set Resultset's pointer, enable it to move up and down, and move to the first row of the result set and the last line? A: In JDK1.1, only NEXT is defined in the ResultSet class. The method supports the downward of the data pointer. But in Java 2, the ResultSet class adds the following method to support the movement of the data pointer, including:

ResultSet.First (): Move the data pointer to the first line of the result set ResultSet.last (): Move the data pointer to the last line of the result set ResultSet.Previous (): Move the data pointer to one line

The above methods are defined in the JDBC2.0 specification, all JDBC drivers that support JDBC 2.0 can support the above methods. JDBC driver manufacturers such as INTERSOLV and OpenLink have product support JDBC 2.0. Java Advanced Imaging API

Tomcat

Tomcat is a servlet container with JSP environments. Servlet container is a shell that can manage and activate servlet based on user behavior. Roughly can divide the servlet container into a few categories: Separate servlet container has a web server Part of the part of the Java-based web server, such as the servlet container is a part of JavaWebserve. The stand-alone servlet container is the default mode of Tomcat. Most web servers are not based on Java, so we can get the following two Pattern of container. The servlet container servlet container in the process is a web server's plugin and the implementation of the Java container .Web server plugin opens a JVM (Java Virtual Machine) internally, to make Java containers to run internal. If there is a certain The request for servlet is required. The plugin will acquire the control of this request and deliver him (using JNI) to the Java container. Process Content For multi-thread, the server is very suitable and provides a good running speed, but telescopic The sex is insufficient. The Servlet container Servlet container runs outside the web server and the combination of the web server's plugin and the implementation of the Java container .Web server plugin and Java container JVM use IPC mechanisms (usually TCP / IP) Communication. When a request to call the servlet arrives, the plugin will acquire the control of this request and deliver it (using IPC, etc.) to the Java container, the process outer container is not as good as the process instrument However, the process outer container engine is better (scalability, stability, etc.) in many other comparable ranges. Tomcat can be used as a separate container (mainly for development and debugging) and can be added to existing servers ( The Apache, IIS, and NetScape servers are currently supported. That is, you must decide how to apply him, if you choose the second or third mode, you still need to install a web server interface. What is the difference between Tomcat and JSERV? Tomcat Is JSERV? This is a common misunderstanding. Jserv is Servlet API2.0 compatible with the container used with Apache. Tomcat is a fully rewritten and container compatible with Servlet API2.2 and JSP1.1.

2) cookie

l In Java servlet, if you are cookie cookie = new cookie (name, value)

Then when the user exits Browser, the cookie will be deleted without being stored on the client's hard drive.

If you want to store cookies, you need to add a cookie.setmaxage (200)

l cookie is related to a server, a servlet running on the same server, sharing a cookie. Halfway ....................

转载请注明原文地址:https://www.9cbs.com/read-99336.html

New Post(0)