Development of the Land Route-JSP connection database is encountered on the first day of development

xiaoxiao2021-03-06  34

Development of the Land Route-JSP connection database is encountered on the first day of development

Today is the development of JSP on the first day, launch MySQL, Tomcat, and Eclipse. 1. Building a JSP directory first, named ZDJSP. This will be stored in this directory in this directory. After the development is complete, package the directory to WAR and publish it to the Tomcat's webapps directory. 2, use the Lomboz wizard to generate a Tomcat project. 3. Generate an index.html file in the root directory, which is a login Form, Action connected to a login.jsp file. 4. The real test begins. With the Lomboz wizard, create a JSP file. 5. Write the basic statement of access to the database in the JSP file ------------------------ Class.Forname ("Org.gjt.mm. mysql.Driver ".) newInstance (); String url =" jdbc: mysql: // localhost / zddb user = root & password = & useUnicode = true & characterEncoding = UTF-8 "; Connection conn = DriverManager.getConnection (url); Statement stmt =? Conn.createStatement (ResultSet.Type_Scroll_Sensitive, ResultSet.concur_updatable); ResultSet RS = Stmt.executeQuery (SQL); ------------------------ 6 After the deposit, Eclipse will automatically compile the JSP file. 7, select the ZDJSP item -> Right button -> Properties -> Tomcat, set the WAR's release path to Tomcat WebApps directory 8, select the zdjsp project -> Right button -> Tomcat Project-> Export to the War File ... 9, re- Start Tomcat 10, access http: // localhost: 8080 / zdjsp 11, ok, see the login page, click Submit 12, what is going on? An error 13 that could not be found in org.gjt.mm.mysql.driver, and the MySQL's JDBC driver has been copied to the JDK's lib directory, and also sets ClassPath. 14, write a small Java Application, where the database is used , Run, the result is correct. 15, it is strange. 16, already 0:00, sleep first. zzzzzzzZZZZZZZZZZZZ 17, in the morning, continue to check the information.

转载请注明原文地址:https://www.9cbs.com/read-117859.html

New Post(0)