Java Web directory structure

Source: Internet
Author: User
Tags tld

transferred from: http://blog.csdn.net/javaloveiphone/article/details/7828894directory structure of source files and bytecode files for Javaweb projects

1. The source file directory structure of the new project:

|----MyProject

|----. settings (folder)

|----. classpath

|----. Project

|----. mymetadata

|----src

|----WebRoot

|----Other static files:HTML,CSS,JavaScript, images,jsp pages, etc.

|----index.jsp: The page can be placed directly under the root directory

|----Meta-inf

|----Web-inf

|----Classes root directory: storing bytecode files

|----lib directory: storing third-party class library files

|----Web. XML: Application Deployment description file must be directory

|----TLD File: Tag Library description file

The corresponding explanation:

1, 1,. Settings folder: A configuration file containing various plugins.

1,2,. Classpath: Defines the $CLASSPATH that the project uses at compile time , which is to configure the entire project running environment

<?xml version= "1.0" encoding= "UTF-8"?>

<classpath>

<classpathentry kind= "src" path= "src"/>

<classpathentry kind= "Con" path= "Org.eclipse.jdt.launching.JRE_CONTAINER"/>

<classpathentry kind= "Lib" path= "Lib/dom4j-1.6.1.jar" >

<classpathentry kind= "Con" path= "Com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER"/>

<classpathentry kind= "Output" path= "Webroot/web-inf/classes"/>

</classpath>

From the data we can easily see that the above describes the project's dependent files:

1. Location of the source file (kind= "src")

2. Operating system environment,JDK runtime container (kind= "con")

3. Specific location information of the project's library (kind= "Lib")

4. In each LIB's XML child node, there is additional configuration information about it (for example, the "Javadoc_location" I configured)

5. Output directory of the project bytecode file (kind= "output")

1,3,. MyMetadata: Describes the configuration information for the project in MyEclipse

<?xml version= "1.0" encoding= "UTF-8"?>

<project-module

Type= "WEB" project type

Name= "MyProject" project name

id= Unique identification of the "myeclipse.1343985658390" project within the workspace

context-root= Root path of "/myproject" request

j2ee-spec= "1.4" java standard

Archive= "Myproject.war" > post-packaged war file

<attributes>

<attribute name= "Webrootdir" value= "WebRoot"/> Web ROOT name

</attributes>

</project-module>

1,4,. Project: Describe project information

<?xml version= "1.0" encoding= "UTF-8"?>

<projectDescription>

<!--project name <name>-->

<name>myProject</name>

<!--Engineering Notes- -

<comment></comment>

<projects>

</projects>

<!--compiler specifies <buildspec>: Specific loading method information- -

<buildSpec>

<buildCommand>

<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>

<arguments>

</arguments>

</buildCommand>

<buildCommand>

<name>org.eclipse.jdt.core.javabuilder</name>

<arguments>

</arguments>

</buildCommand>

<buildCommand>

<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>

<arguments>

</arguments>

</buildCommand>

<buildCommand>

<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>

<arguments>

</arguments>

</buildCommand>

<buildCommand>

<name>org.eclipse.wst.validation.validationbuilder</name>

<arguments>

</arguments>

</buildCommand>

</buildSpec>

<!--core features <natures>: Additional Eclipse plug-in required at Runtime--

<natures>

<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>

<nature>org.eclipse.jdt.core.javanature</nature>

</natures>

</projectDescription>

2, the project bytecode file directory structure:

|----MyProject

|----Other static files:HTML,CSS,JavaScript, images,jsp pages, etc.

|----index.jsp: The page can be placed directly under the root directory

|----Meta-inf

|----Web-inf

|----Classes root directory: storing bytecode files

|----lib directory: storing third-party class library files

|----Web. XML: Application Deployment description file must be directory

|----TLD File: Tag Library description file

3. Summary:

With the explanation of the above two directory structures, when the project is compiled, the src and webroot file paths are not available, so when a file is loaded in the configuration file:

<param-value>/WEB-INF/struts-config.xml</param-value>

<param-value>resource/struts/struts-config.xml</param-value> (resource in source file src)

Java Web directory structure

Related Article

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.