Jsp-mysql data can be read but cannot be written-mysql tutorial

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.