Start with J2EE

Source: Internet
Author: User
The first step is to install JDK

Write a hello World ,? In fact, JDK learning is not that simple, and there are two problems with JDK, it is easy to bother JavaProgramPersonnel: one is the classpath problem. In principle, it is necessary to understand how the JRE classloader loads the class. The other is the package and import problems, how to find the path of the class. By clarifying these two problems, we have removed the biggest obstacle to learning Java and using JDK. We recommend that you take a look at Wang Sen's "Java deep Adventure" and discuss these two issues in depth.

Step 2: Learn the Java syntax

Java syntax is similar to C ++, basically the mainstreamProgramming LanguageThere is no new things in Class C or Class C ++, so it takes about half a day to learn the syntax. The only thing to note is that there are several keywords that are not easy to understand: public, protected, Private, static, when to use, why to use, and how to use, it may take a long time for someone to give me some advice. But later I saw thinking in Java, which mentioned these concepts.

Step 3: Learn the features of Java's Object-Oriented Programming Language

For example, inheritance, constructor, abstract class, interface, method polymorphism, overload, overwrite, and Java exception handling mechanism. For a person without an object-oriented language background, I think this process takes a long time, because I have no C ++ experience before learning Java and only C experience, it took me about a month to fully understand these concepts. I tried to repeat, modify, and try the examples in the book and read them over and over again, after reading the past, I had to read it five times before I fully realized it. However, I think if I have C ++ experience, it may take a day or two. In this process, you can take a look at thinking in Java, which provides a thorough explanation of object-oriented. Unfortunately, I didn't see this book when I was studying it, so I spent a lot of time learning it through my own attempts and guesses.

 

Step 4: Get familiar with Java class libraries

The Java base library is the JRE/lib/RT. jar package under the JDK installation directory. Learning the basic library is to learn Rt. jar. There are many classes in the basic class library. It is said that there are more than 3000, and I have not made any statistics. But for us, there are only four at the core:

Java. Lang .*;

Java. Io .*;

Java. util .*;

Java. SQL .*;

The four packages of learning, each of which can be written as a thick teaching material, and o'reilly does. I think it is impossible to study by reading four books if the time is too short. I think the better way to learn is as follows:

First, you must read the entire package framework and understand the composition of the class, interface, and exception of the entire package. It is best to findArticle. The first few chapters of these books that specifically introduce the package should be the introduction of these general frameworks.

Understanding the overall framework of the package is not to be familiar with the usage of each class. Remember what attributes and methods it has. I cannot remember it. Instead, you need to know what types of packages constitute, what are the purposes of these classes, and what functions are completed by the core classes. During training, I usually talk about a package in a class, so it is impossible to describe the usage of each class in detail. However, I have repeatedly stressed that, what I want to tell you about these packages is not to tell you how class methods are called, nor to remember the class method calls, but to understand, java provides us with classes, where each class is used, and when I encounter a problem, I know which class or which combination of classes can solve my problem, that 'all !, When writing a program, you only need to know which class to use to complete your work. During encoding, the specific method is called by writingCode, While querying documentation, everything is in documentation. You do not need to remember it. Actually, you cannot remember a total of nearly 3000 method calls of more than 0.1 million classes. Therefore, it is extremely important to grasp the overall framework of each package.

Through the above study, if the learning is solid, it will lay the foundation for Java, the rest of the work is to clear some useful classes except the above four packages in documentation. I believe that the progress has reached this step, and Java's self-learning capability has been developed. Now we can directly learn documentation. In addition to Gui programming, other useful packages in JDK are:

Java. Text .*;

Java.net .*;

Javax. Naming .*;

There are actually few classes in these packages, so it does not take a lot of time.

Step 5 Java Web Programming

The core of WEB programming is the HTTP protocol. The HTTP protocol has nothing to do with Java. If you are not familiar with the HTTP protocol, you can also learn Servlet/jsp programming well, but it cannot reach the same level. Therefore, learning the HTTP protocol is essential. If I am familiar with the HTTP protocol and have a good foundation for Java programming, it would be easy to learn Servlet/JSP. It took me less than a week to learn Servlet/JSP, then we started to use JSP for the project.

In Servlet/jsp learning, the beginning is still servlet documentation. The most common classes of servlet APIs are very few, so it takes a little time to master them. Read all these classes and write several more examples. The essence of Servlet/jsp programming is to call these classes repeatedly to communicate with the Web server and Brower over HTTP. In addition, for JSP, you also need to be familiar with several common JSP tags. If the specific writing method cannot be remembered, you can temporarily check the tags.

In addition, the focus of Java Web programming learning should be on the Design Pattern of Web applications. How to analyze the business logic and make rational design, in accordance with the requirements of the MVC design pattern, use Servlet and JSP to complete different logic layers, Master how to control the process and share data between Servlet and JSP, and how to configure and deploy Web applications.

Step 6 J2EE Programming

If the above learning process is relatively smooth, the difficulty increases sharply. Because the above knowledge only involves one aspect, and core J2EE specifications such as EJB, JMS, and JTA are often the result of the comprehensive application of several Java technologies, therefore, it is difficult to master.

First, you must learn the JNDI. The JNDI is the method used by the app server to locate server resources (EJB components, datasouce, JMS). If you are not familiar with JNDI, EJB, JMS is almost impossible to learn. JNDI is actually the javax. Naming. * package, which is easy to use. The difficulty lies in the configuration of server resource files. For the server resource file configuration, you need to look at the specific documentation specifications, such as web. xml writing, ejb-jar.xml writing and so on. You need to be familiar with each different app server and its own service resource configuration files.

Then we can learn about JTA, mainly to understand the JTA's method of controlling transactions, and where to use JTA. Here is a simple example. We know that transaction control (Conn. setautocommit (false ),...., conn. commit () is used as an atomic operation, but if my business needs to use operations on two different databases as an atomic operation, can you do it? At this time, only JTA can be used. Assume that the operation first inserts a record into database A and then deletes another record in database B. We cannot control the entire operation as an atomic operation by writing code on our own. If JTA is used, the app server controls it.

Before learning EJB, you need to learn Object serialization and RMI. Rmi is the foundation of EJB. Next, we will learn about JMS and ejbs. The most important thing for ejbs is to understand how ejbs call remote objects through RMI, and under what circumstances to use ejbs.

After learning about EJB and JMS, you may realize that you need to learn more about the two fields: UML and design pattern. Java Enterprise software design attaches great importance to Framework Design. A good software framework is a necessary condition for successful software development. At this time, we should begin to focus on the learning of the design mode and framework, and master the EJB Design Mode and the core mode of J2EE through learning and practical programming experience.

In the J2EE specification, there are many enterprise technologies in addition to EJB, JMS, JTA, Servlet/JSP, and JDBC, which are not described here.

There is also a new field of Web Services. Web Services does not have any new things at all. It is like a binder. Different services can be unified to provide a unified call interface. for users, I only need to obtain the WSDL (service description) provided by the service provider. I have no idea whether the service provided by the server provider is an EJB component or. I don't need to know about the net component, what is the CORBA component, or other implementations. The greatest part of web services lies in the sharing of Internet services by means of unified service provision and calling. It is a very exciting technical field.

Overview:

1. Struts is an open source framework for developing Web applications using Java Servlet/JavaServer Pages technology.

2. Struts can be used to develop an application architecture based on the Model-View-controller design model.

3,: http://jakarta.apache.org/struts

Background:

1. Struts was first launched as part of the Apache Jakarta project. The project creator hopes to improve and improve the technical standards of Java Server Pages, Servlet, label library, and object-oriented through the study of this project.

2. the struts name comes from the supported metal racks used in construction and old-style aircraft. It aims to reduce the time needed to develop Web applications using MVC design models.

Function:

1. contains a controller servlet that can send user requests to corresponding action objects.

2. the JSP free tag Library provides Association support in the Controller servlet to help developers create interactive form applications.

3. provides a series of practical objects: XML processing, automatic processing of JavaBeans attributes through Java reflection APIs, and International prompts and messages.

Learn more:

Like many Apache projects such as Tomcat and turbine, Struts is an open-source software, which provides developers with a deeper understanding of its internal implementation mechanism.

In addition, the advantages of struts are mainly embodied in two aspects: taglib and page navigation. Taglib is a struts tag library, which can be used flexibly to greatly improve development efficiency. In addition to common JSP tags, JSP developers in China rarely develop their own tags. Struts may be a good starting point.

As for page navigation, I think that will be a future direction. In fact, this makes the system context clearer. With a configuration file, you can grasp the relationship between all parts of the system, which is of great benefit for later maintenance. This advantage is especially evident when another group of developers take over the project.

How to Learn struts:

Struts is important to the eight elements in struts_config.xml. You can focus on this.

Second, the labels in struts focus on the following: HTML tags, bean tags, and logic tags. In this way, you can use struts to develop Web applications.

HTML tags in struts are similar to common HTML tags. Generally, people with Web basics can grasp them very quickly. The reason why this label is used is because the struts form submission action method is bound with the tag, which is mandatory.
Bean labels are prepared for form in the form. VO In modu2 can use form in struts to work with form submission, information storage, and information display.

The logic tag is used to traverse the list set returned from the action (easy to use ). You do not need to write such Java statements on the page.

In general, labels are mostly used to simplify the Page code or even zero Page code, which looks neat and easy to maintain and work.

Among the three frameworks, it is recommended to select struts, then hibernate, and then touch spring.

Struts recommended materials:

Well-versed in struts: MVC-based Java Web design and development.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.