Java Web Series: Fundamentals of Java Web projects

1. Java web module structure

JSP files are similar to axpx files. Paths and URLs correspond to each other one by one and are dynamically compiled into separate classes. Java web and ASP The core of asp.net is and interface respectively. Therefore, both the basic page file (JSP, ASPX) mode and the later MVC mode (spring MVC, asp.net MVC) are encapsulated and extended again based on the core interface (,).

Except JSP files, all other files are deployed in the subdirectory of the application directory, and the WEB-INF directory can be regarded as ASP Net Config file, bin directory and app_ The first run-time directory is stored in a unified root directory.

Configuration file for Java Web XML is also stored in the WEB-INF directory, while ASP Net configuration file Config is generally stored directly in the application directory (other directories of asp.net can also have web.config files). Asp.net deploys all references and code generated DLLs in bin, while Java Web Reference jars and generated classes are stored in the subdirectories lib and classes of WEB-INF respectively (reference 1).

To sum up, it is similar to ASP Net, Java Web, etc. we must understand and master.

|--Assembly Root
  |---WEB-INF/
    |--web.xml
    |--lib/
    |--classes/

2. Basic structure of Java Web project [eclipse dynamic web project]

project

(1) You can configure the source directory and output directory to be compiled. By default, compile the source files in the SRC directory to the directory.

(2) The root directory of WEB-INF can be configured. The default is.

(3) You can choose whether to generate a default file.

We create a default generated web. Net named dynamicwp Dynamic web proejct project for XML. The document structure is as follows:

|--DynamicWP
  |--.settings/
  |--build/
    |--classes/
  |--src/
  |--WebContent/
    |--Meta-INF/
      |--MANIFEST.MF
    |--WEB-INF/
      |--web.xml
      |--lib/

In the Project Explorer of eclipse, the view of the dynamic WP project is as follows:

|--DynamicWP
  |--Deployment Desciptor
  |--JAX-WS Web Services
  |--Java Resources
  |--JavaScript Resources
  |--build
  |--WebContent
    |--Meta-INF/
      |--MANIFEST.MF
    |--WEB-INF/
      |--web.xml
      |--lib/

3. Basic structure of Maven web project

In view of the large number of Java ides and certain support functions, the Java Web project of eclipse is not portable. It not only solves the problem of standardizing the project structure, but also provides powerful functions such as powerful reference processing. It has become a de facto standard in project layout. The main structure of Maven project is as follows (reference 2):

|--root
  |--
  |--/
    |--main/
      |--java/
      |--resources/
      |--webapp/
    |--test/
      |--java/
      |--resources
  |--/
|--MavenWP
  |--pom.xml
  |--.project
  |--.classpath
  |--.settings/
  |--src/
  |--target/
    |--classes/
    |--m2e-wtp/

Eclipse4. Corresponding project resource management view in 5.1

|--MavenWP
  |--Deployment Desciptor/
  |--Java Resources/
  |--JavaScript Resources/
  |--Deployed Resources/
  |--src
  |--target
  |--pom.xml

Maven's configuration file POM xml:

4.2 basic information

As ASP Net, the core of Java Web is the interface, which is located in javax Servlet namespace. The concept of can refer to ASP Net, various in servlet can refer to ASP Net httpapplicaiton. Whether it's Java or Net is based on HTTP protocol. Java web and ASP Net corresponds to the following:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>