First, what is a Web application
A Web application is an application that can be accessed through the Web (Internet). One of the biggest benefits of Web applications is that users can easily access applications. Users only need to have a browser, no additional software needs to be installed.
Why do you want to learn Web applications?
Because Web application development, is one of the three major directions in the field of software development at present.
The three main directions of software development are:
1. Desktop application (c/S architecture)
2. Web application (b/S architecture)
3. Embedded applications (mobile development, etc.)
Javaweb Development is one of the three main directions of Java development, which belongs to EE direction.
Second, static Web pages and Dynamic Web pages
Note: Dynamic Web page dynamic refers to the ability to interact with the user, such as login to enter the correct user name and password, the system will prompt the login success.
Third, build the Java Web Development environment
Learning to build a Java Web development environment is one of the most basic skills to learn JSP Dynamic Web site development.
The tools you need:
3.1. Introduction to Tomcat Server
It is an open source project of Apache Jakarta, Jsp/servlet container.
3.2, Tomcat7.0 installation and configuration
1. Unzip the Tomcat installation package to the specified directory
2. Configuring the Tomcat environment variable
Variable name: Catalina_home variable Value: The Tomcat root directory is the extracted directory
3. Run Startup.bat do not close this window
4. Open the browser test http://localhost:8080
3.3. Tomcat directory structure
Iv. manually writing the first Web program
Create a folder of our own Web program under the WebApp directory under Tomcat, create a index.jsp file, write it, and then create a Web-inf folder that requires an Web. xml file that can be obtained from the example folder. At the same time, the Web-inf folder also requires the class file to be used to store the compiled generated bytecode files, Lib folder for storing the required jar package. This allows us to run our first Java Web program on Tomcat.
Note: Create a folder in the WebApps directory, and then include the necessary Web-inf directory, where Web-inf directory must contain the Web. XML, Classes folder (save compiled class file), Lib folder (save Jar package);
The Web-inf directory is a secure directory that can only be accessed through code and cannot be accessed through the browser's address bar.
4.1. Web-inf directory structure
Note: You can set the application's Welcome page, which is the default page, in the Web. xml file.
For example, if I need to set up a JSP file as a welcome page, then we need to use <welcome_file_list><welcome_file>/jj.jsp</weclome_file in Web. xml ></welcome_file_list> such a way to set jj.jsp as the default Welcome page.
Five, MyEclipse Development Java Web Program 5.1, MyEclipse Introduction
5.2. The difference between MyEclipse and eclipse
5.3. MyEclipse Configuration JRE
Specific procedures:
5.4. MyEclipse Integrated Tomcat Server
Specific procedures:
Test is configured successfully:
5.5. MyEclipse Web project directory structure
Vi. Understanding Web Project Virtual Paths
What is the project's virtual path: just like when accessing the http://localhost:8080/virtual path/jsp file name)
The virtual path and the name of the project are the same, you can modify the name of the virtual path, the access time is not the name of the project, but the name of their own modification.
How to modify:
To change the virtual path method: Right-click the Web project, tap propertise---myeclipse---web, change web-context-root (that is, the changed virtual path name).
Modify the name of the project on MyEclipse and then restart the Tomcat server to access it with the new virtual path name.
Vii. development of Java Web programs by eclipse
To write a Web program using Eclipse, you must be an Eclipse Java EE version.
For example, use version: eclipse-jee-helios-sr2-win32-x86_64
Step: new>project>web>dynamic Web Project
1, fill in the Javaweb program name
2. Configuring the Tomcat server and path
Directory structure:
Viii. Modifying the Tomcat server default port number
Modify the Tomcat installation directory:
Java meets html--jsp article Javaweb introduction