Student achievement management system [JSP+Servlet+MySQL]
One, environment configuration
Software Requirements
- Eclipse IDE for Java Developers - 2020-12
- MySQL 8.0
- apache-tomcat-9.0.41
- Navicat Premium 15
Software installation and various configurations
Eclipse
First install the JDK to make your computer support java compilation.
Enter the JDK download official website
. Choose the version according to your computer's number (x86 version for 32-bit, X64 version for 64-bit). After the
download is complete, double-click the downloaded file to enter the installation ( The specific process is omitted, just follow the prompts of the installation wizard to install)
Note that you need to remember the installation path of the JDK, and you need to use it in the subsequent environment variable configuration.
My installation path is to
configure the environment variable. Right-click this computer and select properties. Click Advanced System Settings, click Environment Variables , and enter the following screen.
In the'System Variables', create a new JAVA_HOME, if it already exists, click Edit. The variable value is the installation path.
In the system variable PATH added in% JAVA_HOME% \ bin
in the 'system variables', create the CLASSPATH, If there is already the click Edit.
Variable value;.% JAVA_HOME% \ lib \ dt.jar;% JAVA_HOME% \ lib \tools.jar; (pay attention to the small points in the front, do not miss)
The configuration of the JDK environment variables is completed after this step is executed. In order to verify whether the JDK configuration is completed, Windows+R, enter "cmd", respectively in the command line Enter "java", "javac", and "java -version". If it is the same as the figure below, the JDK configuration is successful.
- java command
- javac command
- After the java -version command
, you can install the
eclipse download address.
Enter the page and click Download. The interface will prompt you whether to donate to eclipse. You can ignore it.
After a while, you can start the download and double-click the downloaded file to enter eclipse. Install, select this version to install.
Select the storage path, click install to complete the installation.
Then open eclipse to configure and
perform the above operations to enter the following interface, click "1" to select the download address, and check "2" all (this I have already downloaded it), and then click "next" below to
perform the following operations and then click "install" below to start downloading. The download process is relatively long, and the waiting process can enter the following MySQL or Tomcat installation and configuration
database
Because my computer installed MySQL a long time ago, I am not sure about the specific installation process of MySQL. You can refer to this blog
and the Navicat installation and configuration reference blog.
Tomcat
Official website download address
Check the top two for the green version (this version needs to be configured with environment variables), and the next one is for the installation version.
I installed the green version. Here I also need to choose to install it according to the number of bits of my computer. The previous one is 32-bit and the next is 64-bit. After the
download is complete, it is a compressed package. I unzip it to the Tomcat folder on the F drive. , Remember your decompression location, you need to use it when configuring environment variables.
Open the environment variables page. The operation is the same as the operation of the JDK configuration above.
In the'System Variables', create a new TOMCAT_HOME, if it already exists, click Edit. The
variable value is decompressed path
in the 'system variables', create CATALINA_HOME, if there is already the click edit.
variable value of the extracting path
added in the pATH% CATALINA_HOME% \ bin
added% CATALINA_HOME% \ lib \ servlet- api.jar CLASSPath in the ( There is no semicolon behind)
Install the Tomcat9 service item
Windows+R in the system , enter "cmd" to enter the command line, enter "service install Tomcat9" to download the tomcat9 service item (change according to the version downloaded by yourself),
open the "Service" page, and start tomcat service. Configuration is now complete
2. Project execution
Migration project
The code connection is https://github.com/G-lory/StudentAchievementManagementSystem
Open eclipse, and proceed as follows.
Select the unzipped project, select the entire folder directly, click "finish" after the selection is complete, and
find that there is an error here because it is missing Servlet library
Right-click the project name, and the operation is as follows.
Then import the servlet library in libraries. The servlet library can be found in tomcat. The specific path is as shown
in the figure below. Note that there is a mysql-connecter-java database library in the libraries, which is brought by the code author Yes, the existence of this database will not have any impact on the generation of our web pages, but an error will be reported when connecting to our data later: java.sql.SQLException: Access denied for user'root'@'localhost' (using password: YES ) site:blog.csdn.net , this problem has bothered me for a long time, so we delete it here
Go back to the page and see that there is no error
. The operation is as follows, delete the "WebContent" folder in the directory, and change the name of the "WebRoot" folder to "WebConten"
After the operation is completed, there is no problem with the code
Configure tomcat environment
Click "Windows" and select the last item "preferences" to enter the following page.
Click "add", select the same item as your tomcat version, click "next" to
find your tomcat installation package, import it, and finally click "finish" and
click "Apply and close" to complete the configuration,
proceed as follows to start the configuration of "server",
double-click "server"
to complete the display,
then right-click to select this
item , and the operation is as follows . Configure the project on tomcat
So far, the configuration is complete
Connect to the database
Open Navicat and create a new connection. The default connection name is just fine, because the database connection name in the code is the default, and the password is set by yourself when installing MySQL. If you forget, please reset it by Baidu.╮(╯▽╰)╭Right
click just To create a connection, select "new database", name "studentmanagement" and
click "confirm", right-click on the newly created database, select "new query" and
enter the code for creating the table into it, return the code for creating the table to eclipse, and open the " WebContent----sql", open "scoreInfo.sql", copy and run the marked codes separately.
Open src–com.wenr.util–DBUtil, and change the password of the database here, that is, the password of MySQL
Then it can run successfully
Three, running results
run on eclipse
Right-click the project name, "Run As", then select "1 Run on Server" and
select "finish". The
interface is as follows, the account and password are both "001", and the login identity is "Administrator"
Run on the browser
Copy the address directly from eclipse to the browser to realize the operation on the browser. The
function can be realized as follows:
Reference
Student Score Management System 3.0 (JSP+Servlet+MySQL)
Navicat Premium 15 Permanent Activation Edition Installation Tutorial
Apache Tomcat Installation and Configuration Tutorial