Article From:https://www.cnblogs.com/pegasus827/p/9124551.html

In front of the manual configuration of an application, manual configuration can be more in-depth understanding of the distribution of web applications, but the general editor has no grammatical errors, so it is not easy to develop the search for error and is relatively inefficient, so after understanding the structure of the web project, we use ECLIPSE development can make it more efficient

  Development can be done with eclipse for JavaEE or MyEclipse, and the project directory is roughly the same, but the way it runs is different. Eclipse is a virtual environment execution application, and when MyEclipse runs, the project is still a project.Publish to webapps running in Tomcat server, both developed the same, use eclipse to talk about the development steps of Java web application below.

  After starting eclipse, click the “File” -&gt in the menu bar; “New” -> “Dynamic Web Project” to create a dynamic website project.

  

  Then the project name in the pop-up dialog box is filled with Jsp1, and the default value of the Target runtime is none by default, and we need to select the Tomcat run environment and click the New Runtime button

  

  Then a new dialog box is popped out, and the environment is selected based on the actual running environment on our computer, where I choose Apache Tomcat v7.0 or 8 and then click Finish

  

  Then click Browse to select the installation location of the Tomcat server, that is, the path of the JAVA_HOME environment variable, and then click Finish.

  

  Now, a Web project has been established, and the directory structure is basically as follows:

  

  WebContent is the storage directory of our JSP source file. There are two catalogues of WEB-INF and META-INF, which are consistent with our previous web application directory.

  Now let’s create a new source file, right-click on WebContent, select “New” -&gt, and “Jsp File”.

  

  In the pop-up menu, fill in the file name of JSP in File name. Fill in index.jsp here and click Finish.

  

  Well, when a simple web application is completed, we can click the Green Run button above to run the application, or right in the code editor to select “Run As” -&gt in the pop-up menu; “Run on Server” run program.

  

  This time pop-up dialog box, we directly click Finish to start running.

  

  At this point, the server starts up, then opens a built-in window in eclipse, and then displays the corresponding page.

  Note that in our eclipse working directory, a Servers directory will appear in the same level directory with the project, which is a directory generated by the eclipse configuration running environment and can be seen in the project manager.

  

  Note that this directory should not be deleted, otherwise the program can’t run, and it needs to be rebuilt, and the Server.xml, web.xml, context.xml and other configuration files are in this directory

  At present, the server is running, and we can access it correctly by opening the browser and entering http://localhost:8080/Jsp1/index.jsp.

  At this point, we can see the list of servers and running items that we configured in the Servers tab of the eclipse window below.

  

  We can easily right-click to select startup, stop, restart and so on, and then debug the project through browser.

  eclipseThe project directory can’t be copied directly under webapps, but we can integrate the WebContent and build directories into native projects and run it manually; the more commonly used way is to export the project’s war format package directly to the Tomcat application directoryYes, the server will automatically unpack the runtime

  

  Finally, how do we delete the original configuration options and restart the configuration if we have too many configured servers or misdeletions that cause the server to fail?

  First, right-click the Servers directory in the project manager, select Delete, then delete delete files.

  After the following server stops, we also right-click to delete the configuration and delete the server option.

  Finally, click the “Window” -&gt in the menu bar; “Preferences” is the meaning of the preferred item.

  

  Then in the pop-up dialog box, select “Server” -&gt on the left, “Runtime Environments” and then select the server on the right to click the “Remove” button to remove it, and then click the OK button to complete it

  

  This time we have cleaned up, so we can start reconfiguring the development environment of Java web.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *