Introduction to enterprise development

JavaEE standard

JavaEE The norm is J2EE The new name of the specification , In the early days it was called J2EE standard , Its full name is Java 2 Platform Enterprise Edition, By SUN Company leader 、 Industrial standards jointly formulated by various manufacturers and widely recognized (JCP Members of the organization ).

among ,JCP organization ( Official website ) The full name is Java Community Process, It's an open international organization , Mainly by Java Developers and licensees , The function is to develop and renew , Founded on 1998 year .

JavaEE Norms are numerous Java The general name of development technology . These technical specifications are adopted from J2EE Of , It includes 13 Technical specifications , Such as jsp/servlet、jndi、jaxp、jdbc、jni、jaxb、jmf、jta、jpa、EJB etc. .

JavaEE The version of continues J2EE Version of , However, it did not continue to adopt its naming rules .J2EE Version from 1.0 Start to 1.4 end , and JavaEE The version is from JavaEE 5 Version started , Please refer to :JavaEE8 Specification Overview .

Web summary

Web In English, it means mesh 、 The Internet . In the field of computer , It usually refers to the latter , namely The Internet .

image WWW By 3 Words , namely World Wide Web, The Chinese meaning is web ; and HTML、CSS and JS Reference documents for 《W3School A full set of tutorial 》 Medium W3C Namely World wide web consortium .

Their appearance is to let us obtain resources in the network world , Where these resources are stored , We call it Website . We enter the address of the website ( Website ), You can access the resources provided in the website .

All the content we can access on the Internet is resources ( No distinction between LAN and wan ). It's just , Different types of resources show different effects . Resources can be divided into static resources and dynamic resources :

  • Static resources refer to , The resources provided to people in the website are unchangeable , That is to say, different people or at different times , The content you see is the same . for example : The news we saw , The user manual of the website , Website function description document and so on . And as a developer , We wrote html、css、js、 picture 、 Multimedia, etc , Can be called static resources .

  • Dynamic resources refer to , The resources provided to people in the website are generated by the program , At different times or with different people, due to different identities , What you see is different . for example : We are 12306 Buy a train ticket on the train , The remaining number of train tickets varies with time , It will gradually decrease , Until the end, there were no tickets left . also , We are CSDN Download the information , Only after successful login , And the points are enough to download . Otherwise you can't download , This is the difference between visitor identity and membership . As a developer , We wrote JSP、servlet、php、ASP And so on are dynamic resources .

About the division of Wan and lan , Wan refers to the World Wide Web , That is what we call the Internet ; LAN refers to the network that can be accessed within a certain range , Out of this range , A network that can no longer be used .

Introduction to system structure

  • according to infrastructure Divide :C/S structure ,B/S Two types of structure .
  • according to Technology selection Divide :Model1 Model ,Model2 Model ,MVC Model 、 Three layer architecture + MVC Model .
  • according to Deployment way Divide : Integrated architecture , Vertical split Architecture , Distributed architecture , Flow computing architecture , Microservice architecture .

C/S structure

It refers to client —— The server The way , among C Represents the Client,S Represents the server .

C/S The system design diagram of the structure is as follows :

B/S structure

It refers to browser —— The server The way , among B Represents the Browser,S Represents the server .

B/S The system design diagram of the structure is as follows :

The differences and advantages of the two structures

The difference between the two structures

  1. The hardware environment is different :C/S It is usually built on a dedicated network or a small-scale network environment ( LAN ), And you have to install the client ; and B/S It's built on a wide area network , Strong adaptability , Usually there is an operating system and a browser .

  2. C/S Structure ratio B/S The structure is safer , Because the user base is relatively fixed , Better protection of information .

  3. B/S Structure maintenance and upgrading is relatively simple , and C/S It is relatively difficult to maintain and upgrade the structure .

advantage

  1. C/S: Is to give full play to the client PC Handling capacity of , A lot of work can be submitted to the server after being processed by the client . The corresponding advantage is that the client response speed is fast .

  2. B/S: Low total cost of ownership 、 Convenient maintenance 、 Strong distribution 、 Development of simple , You don't have to install any special software to To operate anywhere , Client zero maintenance , The expansion of the system is very easy , As long as there is a computer that can access the Internet, it can use .

Tomcat

Tomcat Introduce

About servers

The concept of server is very broad , It can refer to a special computer ( It runs faster than an ordinary computer 、 Higher load 、 The price is more expensive. ), It can also refer to the application used to deploy the website .

The following server , It's actually Web The server , Or the application server , It is essentially a software , An application . The function is to release our application ( engineering ), Let users access our application through the browser .

Common application servers :

Server name explain
weblogic Realized javaEE standard , Heavyweight servers , Also known as javaEE Containers
websphereAS Realized javaEE standard , Heavyweight servers
JBOSSAS Realized JavaEE standard , Heavyweight servers , free
Tomcat Realized jsp/servlet standard , It's a lightweight server , Free open source

Tomcat Download and install

Tomcat Official website download address

Tomcat Required support for each version

Tomcat Directory structure

Tomcat Based on using

Tomcat Start stop and problems

problem 1: The start flashed by

  • reason : No environment variables configured .

  • terms of settlement : Configuration JAVA_HOME environment variable .

problem 2: Error message Address already in use : JVM_Bind

  • reason : Port occupied .

  • terms of settlement : Find the application occupying the port .

    • The occupied process is not important : Use cmd command :netstat -a -o see pid, End the process that occupies the port in Task Manager .
    • The occupied process is important : modify Tomcat Your own port number . stay Tomcat Under the table of contents \conf\server.xml Modify configuration :

problem 3: Many exceptions during startup , But it works

  • reason :Tomcat There are a lot of projects in the middle , Every time you start these projects, they start . And some of these items are abnormal .

  • terms of settlement :

    • Can find abnormal items , Just remove it from the release Directory .
    • Can't determine the items that report exception , Just redeploy a new Tomcat.

Other problems

  • For example, an exception occurs during startup , But it doesn't start properly . At this point, you need to deploy a new Tomcat start-up , To make sure it's a system problem , still Tomcat The problem of .

  • At this point, we need specific questions , make a concrete analysis , And then we can solve it symptomatically .

IDEA Integrate Tomcat

Tomcat Configure virtual directory

Configuration of virtual directory , Two ways are supported : The first is achieved by adding labels to the main configuration file ; The second is to write an independent configuration file .

Mode one : stay server.xml Of <Host> Add a... To the element <Context path="" docBase=""/> Elements .

  • path: Access resources URI.URI Name can be used at will , But you have to add a “/”.
  • docBase: The physical address of the disk where the resource is located .

Mode two : Is to write an independent xml file , The file name can be used at will , But write a in the file <Context/> Elements .

  • The document should be placed in Tomcat In the directory conf\Catalina\localhost\ Under the table of contents .
  • It should be noted that , After using a separate configuration file , Access resources URI It becomes /+ The name of the document , and Context Of path Property is no longer valid .

Tomcat Configure the virtual host ( domain name )

stay <Engine> Add a... To the element <Host name="" appBase="" unparkWARs="" autoDeploy="" />, among :

  • name: Specify the name of the host .
  • appBase: Application publishing directory of the current host .
  • unparkWARs: Whether to automatically decompress at startup war package .
  • autoDeploy: Whether to automatically publish .

An example configuration is as follows :

<Host name="www.itcast.cn" appBase="D:\itcastapps" unpackWARs="true" autoDeploy="true"/>

<Host name="www.itheima.com" appBase="D:\itheimaapps" unpackWARs="true" autoDeploy="true"/>

Tomcat Default item configuration

Configure default port

Tomcat The access port is configured in the main configuration file of the server , The value it writes in the configuration file is :8080. The configuration is as follows :

<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

Configure the default app

There are two ways to configure the default application .

Mode one : Put the application to be the default application , Change the name to ROOT, Put it in webapps Directory .

Mode two : Write a separate configuration file , The file name is called ROOT.xml.

  • Be careful :ROOT Capital must be written. . When using independent ROOT.xml When you file ,webapps Next ROOT The application is no longer the default application .

Configure the default home page

The first thing to be clear is , Configuring the default home page is for the application , Is the default home page of the application .

In application web.xml Middle configuration :

<welcome-file-list>
<welcome-file> The default home page </welcome-file>
</welcome-file-list>

for example :

<welcome-file-list>
<!-- When there are multiple default pages , What you find first shows , Don't look down -->
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Java Web application

Java Web Project Overview

JavaWeb Application is a new kind of application , This kind of application refers to the program accessed by the browser , It's also commonly referred to as Web application .

One Web The application consists of multiple static Web Resources and dynamics Web Resource composition , For example, there are html、css、js file ,jsp file 、java Program 、 Supported by jar package 、 Project configuration file 、 picture 、 Audio and video, etc .

Web After application development , If you want to be accessible , Need to put Web The directory where the application is located , hand Web Server management (Tomcat Namely Web One of the servers ), This process is called virtual directory mapping .

Java Web Application directory structure

myapp --------  apply name 
demo.html
css/demo.css
js/demo.js
WEB-INF -------- If there is web.xml perhaps .class When you file , The directory must exist , And strictly case sensitive .
-------- Resources in this directory , The client is not directly accessible .
-------- The contents of the directory are as follows :
classes Catalog -------- web Applied class file ( Loading order : our class,lib In the directory jar package ,tomcat Of lib In the directory jar package . Its priority is reduced in turn )
lib Catalog -------- web Apply what you need jar package (tomcat Of lib Under the table of contents jar Share... For all apps )
web.xml -------- web The main profile of the application

IDEA establish Java Web Application engineering

Java Web Application deployment

IDEA Deploy

war Package release

Step one : Use command jar -cvf war [ Directory path to package ] pack war package .

Step two : Put the good war Package copy to tomcat Of webapps Directory .

Step three :Tomcat When it starts , Will automatically unzip war package .

JavaEE & Tomcat More related articles

  1. java web The server tomcat Introduce 【 Reprint 】

    Machine matrix 2016-08-10 22:14 java Programmers affectionately call him tom cat , Seeing this cat shows that 1 The server deployment was successful ,2 The network is connected . What is the origin of this cat ? tomcat yes Apache Under the foundation ...

  2. xml and tomcat Introduce

    One xml Introduce : xml: Extensible files function : 1. As the configuration file of the framework 2. It's easy to transfer data over the network <a> <b></b> <c></c> ...

  3. Tomcat Introduce 、 install jdk、 install Tomcat、 To configure Tomcat monitor 80 port

    1.Tomcat Introduce 2. install jdk download :wget -c http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8 ...

  4. 04_web Basics ( One ) And tomcat Introduce

    01.web introduce Before that, we have been able to do... In the database CRUD, stay dao for CRUD, stay service for CRUD, For users, it must be done on the browser CRUD, To accomplish this, you must have web knowledge . and web function ...

  5. Tomcat Introduce install jdk install Tomcat

    Tomcat Introduce Tomcat yes Apache Software foundation (Apache Software Foundation) Of Jakarta A core project in a project , from Apache.Sun Developed with other companies and individuals ...

  6. Tomcat Introduce 、 install JDK、 install Tomcat

    6 month 26 Daily task 16.1 Tomcat Introduce 16.2 install jdk16.3 install Tomcat Expand java Container comparison http://my.oschina.net/diedai/blog/271367 http ...

  7. tomcat Introduction and environment construction

    One .tomcat Introduce Tomcat The server is a free open source Web application server , Application servers are lightweight , In small and medium-sized enterprises Systems and concurrent access users are not widely used in many occasions , Is development and debugging JSP Program preference . ...

  8. Linux centosVMware Tomcat Introduce 、 install jdk、 install Tomcat

    One .Tomcat Introduce Tomcat yes Apache Software foundation (Apache Software Foundation) Of Jakarta A core project in a project , from Apache.Sun With other companies and individuals ...

  9. Web Beginners - Introduction and tomcat Introduction record

    One .WEB Development related knowledge WEB, In English web The meaning of a web page , It is used to show Internet Resources on the host for external access . Internet It's for the outside world to visit Web Resources are divided into : static state web resources ( Such as html page ) ...

  10. [javaEE] Tomcat Installation and configuration

    Download zip , decompression , good , installation is complete Go to unzip directory /bin/ below , find startup.bat, double-click , At this time, if you report an error , Then the environment variable is not set JAVA_HOME, Enter the environment variable to set ,JAVA_HOME Point to jd ...

Random recommendation

  1. Drop it

    FCC subject : I'll sell if I want to , Don't be reluctant to . Let's discard arrays (arr) The elements of , Start on the left , Until the callback function return true Just stop . The second parameter ,func, It's a function . Used to test the first element of an array , If you return ...

  2. .net Application YUI dependent dll Compress js ( According to your own rules , I think it's powerful and interesting )

    Write it at the front Whether it's front-end or back-end , Whether it's understanding javaScript I still don't understand JavaScript People who , I want to know more or more js The effect of compression on page performance . I used to use online compression tools to compress js, ...

  3. JQ Study ( Two )

    jQuery effect jQuery hide() and show() grammar : $(selector).hide(speed,callback); $(selector).show(speed,callba ...

  4. solve cxf+spring released webservice,types,portType and message With import Mode import

    use cxf+spring Released webservice, Find the generated wsdl Of types,message and portType Are subject to import The way to import .. reason : The namespace problem I want to generate wsdl In the same file ...

  5. SpringMVC Analysis of structure

    SpringMVC summary Spring Of web Frame around DispatcherServlet Design . DispatcherServlet The role of is to distribute requests to different processors . Spring Of web The framework includes configurable ...

  6. php Classic interview questions

    1.  use PHP Print out the time of the day before , The print format is 2007 year 5 month 10 Japan  22:21:21 2. PHP The code is as follows :$a="hello"; $b=&$a;unset($b);$b=& ...

  7. redis.conf Configuration details

    http://www.2cto.com/database/201307/225113.html

  8. Android EditeText Inventory of common functions

    This article is a collection of EditText The needs of , A single question has been summarized before , Now put them together for future trouble , It mainly includes the following aspects : 1. Judge the input character length 2. Keyboard display and hide 3. Restrictions on input , List several common ...

  9. [ExtJS5 Learning notes ] Section 35 sencha extjs 5 Summary of component query methods

    One UI There will certainly be more foreground components , We usually use it habitually ID To get the components that need to be operated , But this method is extjs Recommended ? Is there any extjs The recommended method to get components ? Catalog Catalog extjs Of the query component API check ...

  10. 【Homework】LCA&amp;RMQ

    Our school is a seminary , The assignment is from POJ, Don't you know “ Cherish life, Don't brush POJ” Well ? I didn't write all the template questions , So I just hit him 6 Problem ( In fact, we should have played part of the template question before, but I'm too lazy to look for it )( But I don't feel like I'm good enough to slip away from the template ...