Novice Java friends are likely to encounter a lot of problems, the following collection of some for reference.
from: Java Club
1. Ask What do application and applets each refer to? Is there a difference in use?
[Answer]application and applets are two of the most commonly used in the Java language-generated code, both of which must be run on a Java virtual machine. In simple terms,
application more like our usual use of VB,VC, such as desktop programs, many of the console (console) mode of operation, of course, also very easy to implement window applications.
and applets can be embedded in Web pages and run on browsers that support Java virtual machines. The application should be differentiated when used.
2. [Q] I wrote a simple application, also compiled and got a class file, but when I ran it using the JDK's Java command, I reported an error that class could not find.
[Answer] This is a beginner Java often encountered problems, in fact very simple, you look at the program you define the main class
name and you name of the program (*. JAVA) is not the same? This error can occur if the two names are not the same.
3. [Q] I want to learn the Java language, but face a lot of Java development tools, do not know what good?
[Answer] There are a lot of Java development tools, each with its own characteristics. For beginners, it is helpful to use the sun's JDK to start learning and to take advantage of JDK documentation, which is good for the basics of Java. When you formally use Java development projects in the future, you can choose some of the engineering visualization tools, such as Microsoft vj++, and so on. In fact, the JDK and other visualization tools are often integrated into development.
4. [Q] Often see a javascript thing like that, does it differ from Java?
In contrast to Java, JavaScript can not be said to be a complete set of languages, it defines a set of methods, event processing, mainly for Web page development to increase the effect of the page, data validation checks. You can also act as a programming script when developing Microsoft ASP. It has a basic equivalence thing to be VBScript.
Common Chinese Problem solving method:
1.JDK Chinese question:
do not use DataInputStream and DataOutputStream, but with BufferedReader and BufferedWriter.
3. Database Chinese problem: Access + JAVAODBC driver cannot support Chinese (with getbyte () or not), I haven't found a solution at the moment. MySQl + JAVAODBC Driver also has Chinese problem, I have not found a solution at present. MySQL + MM.MYSQL.JDBC does not have any Chinese problems, but set up a data table, the Chinese input field, preferably set to Bianry, otherwise, because the MySQL varchar, char, text and other properties of the domain in the query is case-insensitive, There will be problems with this Chinese query.
4.JSP's Chinese problem. Setpropotery when the Chinese problem, using Urldecoder.decode () for conversion can be.
How do I set the environment variable for Java 2 (JDK1.2)?
Answer:
Java 2 installation, you need to set up path and java_home environment variables. Unlike JDK1.1, when you set up a java_home environment variable, the JVM automatically searches for the System class library and the user's current path.
Solaris Platform: setenv java_home Java2 Installation path
setenv PATH $JAVA _home/bin:${path}
Windows platform: Installation path for set JAVA_HOME=JAVA2
set path= $JAVA _homebin;%path%
Q: Using JDBC programming, how do you control the pointer to the result set resultset so that it moves up and down, and moves to the first and last row of the result set?
Answer:
in JDK1.1, the next () method is defined in the ResultSet class to support the move of the data pointer. But in Java 2, the ResultSet class adds the following methods to support the movement of data pointers, including:
Resultset.first (): Moves the data pointer to the first row of the result set
resultset.last (): Moves the data pointer to the last row of the result set
resultset.previous (): Move the data pointer up one line
The above method is defined in the JDBC2.0 specification, and all JDBC drivers that support JDBC 2.0 can support this approach. Currently, JDBC driver manufacturers such as INTERSOLV and OpenLink have products that support JDBC 2.0.
Java Advanced Imaging API
Tomcat
Tomcat is a servlet container with a JSP environment. The servlet container is a shell that can manage and activate the Servlet runtime based on the behavior of the user.
can roughly divide the servlet container into the following categories:
Standalone servlet container
A part of a Web server is built in. refers to situations where a java-based Web server is used, such as a servlet container that is part of a javawebserver. The standalone servlet container is the default mode for Tomcat.
Most Web servers are not java-based, so we can draw the following two types of container patterns.
in-process servlet containers
The
servlet container acts as a plug-in to the Web server and an implementation of the Java container. The Web server plug-in opens a JVM (Java Virtual machine) in the internal address space to allow the Java container to run internally. If there is a request to invoke the servlet , the plug-in will take control of the request and pass him (using JNI) to the Java container. In-process containers for multithreading, a single process server is very appropriate and provides good speed, but scalability is insufficient.
the servlet container outside the process
The
servlet container runs in an address space outside of the Web server and is a combination of a Web server plug-in and a Java container implementation. Web server Plug-ins and Java container JVMs use the IPC mechanism (typically TCP/IP) To communicate. When a request to call the servlet arrives, the plug-in will take control of the request and pass it (using IPC, etc.) to the Java container, the reaction time of the out-of-process container or the Out-of-process container engine is not as good as the process content device, but the Out-of-process container engine is better in many other comparable ranges (scalability, stability, etc.).
Tomcat can be used as a stand-alone container (primarily for development and debugging) and as an add-on to an existing server (currently supporting Apache,iis and Netscape servers). That is, any time you configure Tomcat you have to decide how to apply it, such as choosing a second or third mode, You also need to install a Web server interface.
What's the difference between
Tomcat and Jserv? is Tomcat Jserv?
This is a common misconception. Jserv is a container that is a servlet API2.0 compatible and is used with Apache. Tomcat is a fully rewritten container that is compatible with servlet API2.2 and JSP1.1.
2) Cookie
L In the Java servlet, if you light a cookie cookie = new Cookie (name,value)
then when the user exits the browser, the cookie is deleted and is not stored on the client's hard disk.
if you want to store cookies, add a sentence cookie.setmaxage (200)
l cookies are associated with a server, and the servlet running on the same server shares a cookie.
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.