Web project design and development-DBHelper3 and dbhelper3
This course aims to add, delete, modify, and query data in the database based on DBHelper.
The specific content is:
I. Program writing
1. Create a project-Mangage
2. Create five packages in the src directory: DAO, DBHelper, Entity, Servlet, and tools.
3. Compile the testDAO test file, userDAO, DBHelper, user entity class, servlet class UserServlet, and code searching online using the java reflection mechanism.
4. Create the jsp file user. jsp, show. jsp, and updata. jsp to add, delete, modify, and query database data.
5. Add the Link Configuration File
2. Run the program
Run as directly on myeclipse tomcat
3. debug and modify the code
When the code is wrong or the webpage is not displayed correctly: First, do not immediately write the code at the other layer after writing the code at the m layer. First, test UserDAO, test the UserDAO program directly in testDAO. After the test is successful, thank you for the next code.
When a servlet error occurs, you should click run on server on run as at the beginning of creation to display another page, even if it is correct, or comment out the code and write the output statement directly.
You can modify the displayed error according to the webpage prompt.
Experience and experience: In this DBHelper test, because many operations are required, you can test the current Code step by step after writing a code, do not wait until all the code is written before testing. If an error occurs, you do not know where the error is. In the process of writing code, you can skip writing, but you must understand the principle. You can discuss it with others.