Reprint J2SE J2ME differences, MVC and SSH contact understanding

Source: Internet
Author: User

Go The difference between J2SE and J2ME and the relationship between MVC and SSH

2014-3-6 Read 322 comments 0

J2SE the difference between J2ME and Java
Most programming languages have pre-compiled class libraries to support a variety of specific functions, and in Java, class libraries are delivered as packages (package), and different versions of Java provide different packages for specific applications.

The JAVA2 platform includes three versions of the Standard Edition (J2SE), Enterprise Edition (Java EE), and mini-version (J2ME):
Standard Edition (J2SE) contains classes that form the core of the Java language.
For example: database connection, interface definition, input/output, network programming
Enterprise Edition (Corporate Edition) The Java EE contains classes in J2SE and also contains classes for developing enterprise-class applications.
For example: EJB, servlet, JSP, XML, transaction control
Micro Edition (miniature version) J2ME contains a classification of J2SE for Software development of consumer electronics products.
For example: pager, smart card, mobile phone, PDA, set-top box

Their scope is: J2SE is included in the Java EE, J2ME contains the core class of J2SE, but some new proprietary classes have been added

Applications, the API coverage varies.
Generally speaking, it is possible to understand:
J2SE is the foundation;
Compression of a point, and then add some CLDC and other aspects of the characteristics is J2ME;
To expand a bit, and then add some EJB and other enterprise application features is the Java EE.

Add a bit of the Java EE more appropriately, should be the JAVA2 enterprise development of technical specifications, not only more than the standard version of a number of classes.
The concept difference of JDK,J2EE,J2SE,J2ME
1.
The JDK is Java Development Toolkit, which is equivalent to Java's library function, which is a toolkit for compiling and running Java programs.
The Java 2 Enterprise Edition is a Java Business Edition for enterprise-Class application service development
J2SE is the Java 2 Standard Edition for standard application development
J2ME is Java 2 Micro Edition is a miniature version of Java, often used in mobile phone development
J2ee,j2se,j2me is Java for different uses to provide different services, that is, to provide different types of class libraries.
Java EE (Java 2 Enterprise Edition) for enterprise network applications, J2SE for common PC applications (Java 2 standard Edition) and J2ME for embedded devices and consumer appliances (2 Micro Edition) Three versions
For beginners, they start with J2SE.

2. The difference between the EE and J2SE:
The Java EE is a series of enterprise application programming interfaces added on the basis of J2SE. The Java EE contains a lot of technology! Among them you are familiar with the JSP,SERVLET,JDBC,JME and other 13 technology!
Java EE is mainly used to do b/s structure of the application! That is, browser-and server-based!
J2se give me the feeling that only need a container is enough, Java EE support for distributed components can exist in multiple containers at the same time


1, what is the Java EE exactly?
The Java EE, which is a standard proposed by Sun, is called "realization", in which one of the Sun's Java EE development packages you download is "implemented", and Jboss,weblogic,websphere is an "implementation" of the Java EE standard. Because Jboss,weblogic,websphere has its own Java EE API, it can be implemented without using Sun's Java EE.

2, the difference between the Java EE SDK and J2sdkee
In fact, you can take the Java EE SDK and J2sdkee as one thing, officially called the Java EE SDK. But if you are careful, you can also use the following method to understand: J2eesdk is the JDK, this is the development of EJG must be installed, J2sdkee is the Java EE development environment, which is to install, in fact, if you installed JBoss, you do not have to install J2sdkee all, Just copy one of the files named Java EE in the past, that is, the JDK must be installed, and J2sdkee does not need to see what you use to make the container.

3, installed the Java EE SDK also need to install J2SE SDK?
When downloading j2ee1.4 on the Sun's website, there are two types of download packages:
One is the j2ee1.4 SDK complete package (all in a), including the Java EE server,j2se, sample, API Doc; The Java EE seems to contain almost everything j2se. I think there is also a JDK in the Java EE, the following Lib is as large as the lib below the J2SE (same version). But the JRE is not as big as the Java EE is a lot more than j2se, like java.servlet.*, Java.servlet.http.* and so on. The Java EE is what you use to develop specification. If it is for a Web server, do not install the Java EE line, just install a JRE (even J2SE not installed), plus a servlet engine ( Like Tomcat) is enough.
Look at the following, at a glance:
J2SE = = JDK = = bin + demo + include + JRE + lib + src.rar//sun official jdk1.4.2
Java EE = = jdk + ...//the JDK here is not as large as the JRE file above, for the reason stated above.
The other is a separate Java EE server, which requires the installation of the J2SE SDK before installation.
Regardless of which, after the installation is complete, set the JAVA_HOME,J2EE_HOME,CLASSPATH environment variable, and then run the Java EE server.
For the convenience of developers, Sun distinguishes Java into J2SE (Java 2 standard Edition), EE (Java 2 Enterprise Edition), J2ME (Java 2 Micro Edition), and Java Card four kinds of platform. J2SE is the foundation of all Java technologies and must be learned from J2SE, regardless of the developer's Java application for which platform to develop. The Java EE technology focuses on enterprise server-side applications. J2ME mainly for embedded systems, including mobile phones, PDAs and so on. For the development of mobile applications, Sun also offers free J2ME Wireless Toolkit. Java card technology is used to develop applications that can be implanted into IC smart cards.
The Software Development Kit (software development kit,sdk) of the four platforms above is free and can be downloaded from the Sun's website. Of course, using the SDK is too much of a shame, we need to develop tools to improve development efficiency. Such tools are called integrated development environments (Integrated development environment,ide). In the past, the two Ides of Borland JBuilder and IBM eclipse were most favored by Java programmers, while Sun's own Ides were unknown. Since 2004, Sun has placed its own IDE in an important position to advance the development of NetBeans and Java studio. The former is an open source tool written entirely in Java, while the latter is a heavyweight official development tool. Sun's development tools are the root of the red, Java programmers finally can bathe Sun (Sun) Shine!

-----------------------------------------------------------------

1. Learn J2SE First

To learn the J2SE to learn the first, just start learning J2SE first recommended not to use the IDE, and then gradually transition to the use of IDE development, after all, with it convenient. Study J2SE recommended two books, "JAVA2 core technology One or two volumes", "Java Programming Ideas", "Java mode". One of the "Java Programming ideas" to study, intensive reading. This period of time is basic learning, time will be very long, it may be very short, it depends on the level of learners themselves.

2. Don't be entangled by the IDE
In the course of learning Java and EE, you will encounter a variety of Ides, do not confuse them, learn Java, to learn the language itself, do not care too much about the IDE's additional functions, Java programming between the different Ides of the conversion is very easy, Too much attention to the IDE's function is likely to delay the understanding of the language itself. The current popular IDE has Jbuilder,eclipse and Eclipse's enhanced version of Wsad. Use one of the best, and recommend the Java EE from eclipse. Because JBuilder is more suitable for writing J2SE programs.

3. Select and learn server usage configuration
When you have J2SE and IDE experience, you can start the Java EE Learning, Web server: Tomcat, needless to know, Tomcat is the first choice for learning Web services. and the application server currently has three main: JBoss, WebLogic, WebSphere. There are a lot of projects that start with JBoss, and a lot of companies are starting to migrate WebSphere or WebLogic to JBoss application servers (cost savings), and here's to say, learning Tomcat and JBoss I think is the first choice and the easiest to get started with. Learning Server Use configuration It's best to ask experienced people (conditionally), because they may be able to solve the problem in a word, you may have to explore the internet for a day or two (I have done such a foolish thing), we should put the main time on the principle of learning and theory, The use of a particular technology can never replace a person's knowledge and learning.

4. Learn Web Knowledge
If you are doing e-commerce sites and so on, you may want to play several roles, which is what you also have to learn:
HTML, you may want to use the IDE such as Dreamwave.
Javascript, learn simple data validation, data linkage display, etc.

5.J2EEAPI Learning
Learning J2eeapi and learning servers should be an iterative process.
First learn JSP and servlet programming, this aspect of the book a lot, I set up to see OReilly Company's two "JSP design" and "Java servlet Programming", oreilly out of the book is always that excellent, have to admire.
Learning JDBC Database programming, the EE project is mostly MIS system, access to the database is the core. This should belong to J2SE study, here take out to emphasize.
Learn the Jndi API, which can be combined with learning EJBs.
Learn EJB API, recommended book "Proficient in EJB"
Through the above study, probably can deal with the general application.
Some people say follow Sun's "Java Tutorial" to learn all the way down, of course.

6. Learn the EJB design pattern and see the code (most important)
The design pattern is to practice the internal strength, its importance can say so, if you do not use the design pattern, you will write a bunch of garbage using EJB, slow is a bunch of bugs, the result is not as good as EJB implementation (EJB is not equal to the Java EE)
No matter what language to learn, you should look at a lot of code, you see the amount of code is not a certain amount, is not good at the Java EE
There are many open source projects that can be used as teaching materials:
Jive Forum
Petstore Sun Ltd.
Dune Sun Ltd.
Wait, read one, and use it in your own project.

7.J2EE Other studies
As you begin to understand the depth of the Java EE, you have to start to focus on some of the technical changes in the current field, and EE is a field of contention, where everyone presents their own solutions, such as structs,hiberate,ofbiz, etc. Learning these things depends on your project and your goals, but it doesn't have to be too deep, after all, learning principles and theories are the most important thing.

8. Current Common J2eeapi
JavaServer Pages (JSP) technology 1.2
Java Servlet Technology 2.3
JDBC API 2.0
Java XML processing API (JAXP) 1.1
Enterprise JavaBeans Technology 2.0
Java Messaging Service (JMS) 1.0
Java named Directory Interface (JNDI) 1.2
Java Transaction API (JTA) 1.0
JavaMail API 1.2
JavaBeans activation Architecture (JAF) 1.0
Java EE Connector Architecture (JCA) 1.0
Java Authentication and Authorization Service (JAAS) 1.0
Learning some of the above APIs depends on your project and it's good to know all of them.
The above confirms that everyone said a word, the Java language itself is not difficult to learn, but the technology is too much, so learning Java is very laborious. In retrospect, basically every beginner, in just learning Java may ask others such a word, how do you know which method (API) in which package? Oh, without him, only hand-cooked.

MVC Architecture and SSH framework correspondence relationship

MVC three-tier architecture: The model layer, the control layer, and the view layer. Model layer, with Hibernate framework to JavaBean in the database generated tables and associations, through the operation of the JavaBean to the database operations, control layer, with the struts framework to connect the data layer and the view layer, receive, process, send data and control process; view layer, Use JSP templates to present the page to the user and to provide interaction with the user. The spring framework, which adheres to hibernate and struts, transparently manages the entire architecture, providing the IOC container for loosely coupled code and the facets of the AOP framework, among other things.

Can also say: we go to a restaurant to eat, the oil in front of us is the JSP rendered view, and this dish how to, of course, there is cabbage, that is, hibernate produced data, cabbage to wash clean, cut well, this is the operation of data; These are ready to fry cabbage, That's what struts is about. This process of clear division of labor, each do, and some are only responsible for washing vegetables, and some are only responsible for cooking, spring is the middle in charge of running errands, let the dishes and stir-fry are relieved to do their own thing. The final dish comes out, and we see the finished dish, but we can't see the process of it being made.

Let me give you an example of how to use the SSH framework for cooking, but here are just some of the simplest sample code to illustrate:

1.JavaBean Class (Model, here is bought cabbage):

public class Building {

Private String Code;

Public String GetCode () {
return code;
}

public void Setcode (String code) {
This.code = code;
}

}

2. Use Hibernite to persist the object to the database (Model, or cabbage, just to change the argument, you can give it a random name, such as the physical Chinese cabbage, but actually the same thing)

<?xml version= "1.0"?>
<! DOCTYPE hibernate-mapping Public
"-//hibernate/hibernate Mapping DTD 3.0//en"
"Http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<class name= "Building" table= "Building" >
<id name= "id" column= "id" >
<generator class= "uuid"/>
</id>
<property name= "Code"/>
</class>

3. Encapsulate access to data as an object-oriented interface (Model, Wash, cut):

Public interface Buildingmanager {

List findentity ();

}

4. Handling of the control layer (Controller, start cooking):

public class Buildingaction extends Action {

Public Actionforward Execute (actionmapping actionmapping,
Actionform Actionform,
HttpServletRequest req,
HttpServletResponse servletresponse) throws Exception {
List results = Entitymanager.finditems ();
Req.setattribute ("Buildings", page);
return Actionmapping.findforward ("list");
}

}

5.jsp view (view, the end of the table of oil-soaked cabbage, here I will not write the sample code).


At this point, we are in the MVC clear architecture, although the code is simple enough to outline how the three framework of SSH to achieve the display of the building list, cabbage can eat.

Reprint J2SE J2ME differences, MVC and SSH contact understanding

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.