The web application in myeclipse has a login registration function. you can read the database during login, but the registration will not work if it is written in. & quot; register. jsp & lt ;! DOCTYPEHTMLPUBLIC & quot;-W3CDTDHTML4.01TransitionalEN & quot; & gt; & lt; metahttp-equ mysqljspmyeclipse
Web applications under myeclipse
There is a login registration function, you can read the database at login,
But registration cannot be written in.
Register. jsp <% @ page language = "java" import = "java. util. *, java. SQL. *, cn.edu. dhu. * "%> <% @ page contentType =" text/html, charset = utf-8 "pageEncoding =" UTF-8 "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %>
<% String name = request. getParameter ("usernamesignup"); String account = request. getParameter ("emailsignup"); String pswd1 = request. getParameter ("passwordsignup"); String pswd2 = request. getParameter ("passwordsignup_confirm"); System. out. println ("name =" + name); System. out. println ("name =" + account); System. out. println ("name =" + pswd1); System. out. println ("name =" + pswd2); if (account! = Null & pswd2! = Null) {System. out. println ("executed"); String SQL = "use jsgl; insert into jsgl. user values ('"+ name +"', '"+ account +"', '"+ pswd1 +"', '"+ pswd2 +"') "; System. out. println ("executed"); Connection conn = DB. getConn (); System. out. println ("executed"); Statement stmt = DB. createStmt (conn); System. out. println ("executed"); int n = DB.exe cuteUpdate (stmt, SQL); response. sendRedirect ("index. jsp "); System. out. println ("executed") ;}%>
All are executed, but there is no information in the database
Ps: the insert statement from the command line can be inserted. myeclipse does not work here.
Please help