•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 423,728 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,271 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 734 | Replies: 4 | Solved
![]() |
•
•
Join Date: Apr 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
html Syntax (Toggle Plain Text)
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.py.db.*, java.sql.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="style.css"> <title>Registration</title> </head> <body> <% String id = request.getParameter("login_id"); String password=request.getParameter("password"); String email= request.getParameter("email"); DataSource ds = new DataSource(); ds.executeUpdate("insert into user (login_id, password, email) value ('"+id+"','"+password+"','"+email+"')"); %> <table align="center" border="0" width="100%"> <tr><td class="titleheader"> you are successful registered</td></tr></table> </body> </html>
why i cant save my data to database?
Last edited by peter_budo : Apr 11th, 2008 at 7:42 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,434
Reputation:
Rep Power: 11
Solved Threads: 295
You should get proper smack on hands for attempting to communicate with db through JSP. The correct way to communicate with bd is collect data from form and send them to servlet, you can do validation either on form page with script or on servlet side. Servlet does all communication with db and you then just collect results either data stored/data retrived/some error occured. JSP is just for presentation purpose it is servlet that is the worker.
Please have look on these tutorials from Sun Microsystems
Please have look on these tutorials from Sun Microsystems
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
•
•
Join Date: Apr 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 1
•
•
•
•
html Syntax (Toggle Plain Text)
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.py.db.*, java.sql.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="style.css"> <title>Registration</title> </head> <body> <% String id = request.getParameter("login_id"); String password=request.getParameter("password"); String email= request.getParameter("email"); DataSource ds = new DataSource(); ds.executeUpdate("insert into user (login_id, password, email) value ('"+id+"','"+password+"','"+email+"')"); %> <table align="center" border="0" width="100%"> <tr><td class="titleheader"> you are successful registered</td></tr></table> </body> </html>
why i cant save my data to database?
hi Friend!
I think You forgotton to use s in values ( its VALUES not VALUE)
Correct Code is :
ds.executeUpdate("insert into user (login_id, password, email) values ('"+id+"','"+password+"','"+email+"')");
![]() |
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Redirect/forward form to another host
- Next Thread: Problems connecting jsp with MySQL database



Linear Mode