One 、 Platform Overview

JavaEE The full name is Java Enterprise Edition, It's a specification and standard for developing distributed enterprise applications

Java Three versions of the platform :

  • Java ME(Java  Micro  Edition)Java Miniature version
  • Java SE(Java Standard Edition)Java The standard version
  • Java EE(Java Enterprise Edition) Java Enterprise Edition

Two 、 Architecture Overview

Java EE The server :

Java EE The server provides deployment for standard application components , Management and operation support

According to what you depend on Of Java EE The server , Application components can be divided into 3 class .

  • Deploy , Manage and run in Java EE Components on the server .(Web Components and Ejb Components )
  • Deployment and management in Java EE Server , But the running components loaded into the client .(Html Pages and embedded pages Applet Of Web resources )
  • Deployment and management are not fully defined in Java EE Components in the specification .( Application client )

3、 ... and 、 Container Overview

A container for Java EE Application components provide a running environment .

The container provides a copy from the bottom Java EE Api To a federated view of application components .

In application components and Java EE Add a container between services , You can let the container transparently inject necessary services into the component .

A standard Java EE The product will define the component type for each application , Provide a container .

Container Overview :

A container is a collection tool for managing component behavior , The behavior of a component includes interaction with the external environment 、 Life cycle of components 、 Cooperation and dependency between components, etc

Java EE Containers :

  • Application client container : Contains the components Application Client
  • Applet Containers : Contains the components Applet
  • Web Component containers : contain Jsp And Servlet Components
  • Enterprises Bean Containers : That is to say EJB Containers , Contains EJB Components

Four 、 service

  summary : Services are between components and containers , And containers and Java EE Interface between servers

5、 ... and 、 Common services

JNDI Acquisition data source

<Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver"
maxActive="100" maxIdle="30" maxWaite="10000" name="jdbc/jndi"
password="accp" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:orcl"
username="accp" />
* adopt JNDI Get the connection
public Connection getConnection(){
Connection conn=null; try {
// Declare the context object
Context ct=new InitialContext();
// Declare data source
DataSource ds=(DataSource) ct.lookup("java:comp/env/jdbc/jndi");
// Get connected
} catch (NamingException e) {
} catch (SQLException e) {
return conn; }


package com;

import java.util.Properties;

import javax.mail.Address;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart; /**
* Send E-mail
public class Mail { private MimeMessage mimeMsg;
private Session session;
private Properties props;
private String username;
private String password;
private Multipart mp; public Mail(String smtp){
} public void setSmtpHost(String hostName){
System.out.println(" Set system properties"+hostName);
props = System.getProperties();
props.put("", hostName);
} public boolean createMimeMessage(){
System.out.println(" Ready to get mail session object !");
session = Session.getDefaultInstance(props,null);
}catch(Exception e){
System.out.println(" Error getting mail session object !"+e);
return false;
System.out.println(" Ready to create MIME Mail to !");
mimeMsg = new MimeMessage(session);
mp = new MimeMultipart(); return true;
}catch(Exception e){
System.out.println(" establish MIME Mail object failed !"+e);
return false;
* Set up SMTP Is it necessary to verify
public void setNeedAuth(boolean need) {
System.out.println(" Set up smtp Identity Authentication :mail.smtp.auth = "+need);
if(props == null) props = System.getProperties();
} public void setNamePass(String name,String pass) {
username = name;
password = pass;
} /**
* Set up email subject
public boolean setSubject(String mailSubject) {
System.out.println(" Set up email subject !");
return true;
catch(Exception e) {
System.err.println(" There was an error setting the subject of the message !");
return false;
} /**
* Set the message body
public boolean setBody(String mailBody) {
BodyPart bp = new MimeBodyPart();
mp.addBodyPart(bp); return true;
} catch(Exception e){
System.err.println(" Error setting message body !"+e);
return false;
} /**
* Set the sender
public boolean setFrom(String from) {
System.out.println(" Set the sender !");
mimeMsg.setFrom(new InternetAddress(from)); // Set the sender
return true;
} catch(Exception e) {
return false;
* Set up recipients
public boolean setTo(String to){
if(to == null)return false;
System.out.println(" Set up recipients !");
return true;
} catch(Exception e) {
return false;
} /**
* Set CC person
public boolean setCopyTo(String copyto)
if(copyto == null)return false;
return true;
catch(Exception e)
{ return false; }
} /**
* Send E-mail
public boolean sendOut()
System.out.println(" Sending mail ...."); Session mailSession = Session.getInstance(props,null);
Transport transport = mailSession.getTransport("smtp");
transport.sendMessage(mimeMsg,mimeMsg.getRecipients(Message.RecipientType.TO)); System.out.println(" Email sent successfully !");
transport.close(); return true;
} catch(Exception e) {
System.err.println(" Failed to send mail !"+e);
return false;
} /**
* call sendOut Method to complete the email
public static boolean sendAndCc(String smtp,String from,String to,String copyto,String subject,String content,String username,String password) {
Mail theMail = new Mail(smtp);
theMail.setNeedAuth(true); // Need to verify if(!theMail.setSubject(subject)) return false;
if(!theMail.setBody(content)) return false;
if(!theMail.setTo(to)) return false;
if(!theMail.setCopyTo(copyto)) return false;
if(!theMail.setFrom(from)) return false;
theMail.setNamePass(username,password); if(!theMail.sendOut()) return false;
return true;

JAVA EE( sketch ) More articles about

  1. java Several versions of and jre,jdk And so on ——【 Reprint 】JDK、Java SE、Java EE、Java ME I should choose

    Some of the software we usually use , Part of it needs to be Java Environmental support , however SUN So many products , Dazzling version numbers , It's the same abbreviation , When we choose, we often shy away , I have to follow my feelings . So what I want to introduce next is that ...

  2. Eclipse for Java EE A collection of software operations ( One )

    Here's me at Java In the process of website development , About software operation Eclipse in , Some problems encountered and solutions provided . One .java web The integrated development tools used in the development are eclipse for Java EE Official download address :htt ...

  3. 【Java EE Study 80 On 】【WebService】

    One .WebService summary What is? WebService, seeing the name of a thing one thinks of its function , Is based on Web Service for , It USES Http To receive and respond to a request from an external system , So as to realize the remote call .WebService In fact, according to certain standards , ...

  4. 【Java EE Study 74 On 】【 Data acquisition system day six 】【 Use Jfreechart Statistical chart implementation of 】【Jfreechart The basic use method 】

    Data collection has been realized before , Now we have the basic data , The next step is to use these data to draw the statistical chart . Use here Jfreechart Realize the drawing of these statistical charts . Let's look at it first Jfreechart The basic usage of , Only when you know its ...

  5. 【Java EE Study 69 in 】【 The first day of the data acquisition system 】【SSH Frame building 】

    after 23 The day's hard struggle , Finally got the data acquisition system ~ Mr. Xu Peicheng is very powerful , I just used it 10 I did the project that was finished in a few days 23 God , Or imitation ... ha-ha , Forget it , In a word, it's finished at last , Now it's time to sort out the project . The content of the first day ...

  6. 【Java EE Study 67 Next 】【OA Project exercise 】【SSH Integrate JBPM workflow 】【JBPM Project practice 】

    One .SSH Integrate JBPM JBPM See you for the basics Now we're going to achieve SSH and JBPM Integration of . 1. add to jar ...

  7. Lightweight Java EE Enterprise application practice ( The first 4 edition ):Struts 2+Spring 4+Hibernate Integrated development ( contain CD Compact disc 1 Zhang )

    Lightweight Java EE Enterprise application practice ( The first 4 edition ):Struts 2+Spring 4+Hibernate Integrated development ( contain CD Compact disc 1 Zhang )( National Award winning works upgrade , Four editions of cumulative printing 27 The circulation exceeds 10 Ten thousand copies of lightweight Jav ...

  8. MyEclipse In the project of java EE 5 Libraries How to re import after deleting

    myeclipse Right click the item in the middle ->properties->java Build Path=>Libraries=>Add Library...=> choice MyEclipse ...

  9. 《Java EE Development techniques and case studies 》 This is a good book : Simple and brilliant ( regret we didn't meet sooner )

    Chapter one :Java EE summary 1.get:JPA:Java Persistence API, Data persistence API: JPA It's a kind of ORM standard , Its implementation example :Hibernate.mybatis 2.Web ...

Random recommendation

  1. UnrealEd3 View navigation

    The version used in this blog :2010-08   [ More other UE3 edition ]     [ Abreast of the times UE3 edition  -- 2015-02]  [unreal engine wiki]    notes :dx11 Be added 2011-03 Monthly Edition ...

  2. 【matlab】 Set up C++ compiler

    In use matlab2016a, Running code involves C++ zlc , Use mex hold C++ The code compiles . I remember a few years ago matlab edition , adopt : mex -setup You can set it , Select the compiler to use ( Hyperlinks to text ), ...

  3. VS2013 Use rtklib Some problems that need to be paid attention to ( compile )

    Recently, because the project needs to rtcm Decode the data ,rtklib Provides a lot of underlying functions , Prepare direct output standard DLL How to provide C# call . Next, we will refer to rtklib The source code needs to note the place to record . 1. First, in the vs2013 in ...

  4. css in important Usefulness

    Today, when I was looking at the code, I came across something I didn't understand . #note_content { line-height: 22px; border: #DEDEDE 1px solid; background: #FAFAFA; ...

  5. openstack Instance migration

  6. UVA 515 King

    The first problem of differential constrained systems , After reading Luohua Dashen's blog , Have a certain understanding of the difference constraint , The key is to build a map , And then it's about judging whether there's a negative weight loop . For an explanation of the differential constraint system, see Wikipedia : ...

  7. ios Empty template configuration

    ios And Xcode6 How to create an empty project template manually 1. First create Single View Application 2. Then find the project catalog ->Supporting Files ——> find ...

  8. sqlite Simple operation of database

    One  sqlite Introduce Sqlite It's an embedded database , Similar to a file system , It's with the program . Follow mysql It's different to separate data from other database programs . Application scenarios : Used to save local configuration , Similar to the local file system , So he embedded ...

  9. Star sky CodeForces - 835C

    With a three-dimensional array cnt[x][y][k] From (1, 1) To (x, y) The brightness is k The number of , And then the query is for each brightness , Calculate the brightness t The brightness after second and the number of current brightness , The answer is their product , And then traverse every ...

  10. QSetting

    . initialization , Judge whether it exists ini file , If not, create a new one void iniConfig() { QFileInfo fileInfo(".\\config.ini"); if (!fil ...