User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Apr 2008
Posts: 1
Reputation: Beryl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Beryl Beryl is offline Offline
Newbie Poster

Registration Problem using Jsp

  #1  
Apr 11th, 2008
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@ page import="com.py.db.*, java.sql.*" %>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  8. <link rel="stylesheet" type="text/css" href="style.css">
  9. <title>Registration</title>
  10. </head>
  11. <body>
  12. <%
  13. String id = request.getParameter("login_id");
  14. String password=request.getParameter("password");
  15. String email= request.getParameter("email");
  16. DataSource ds = new DataSource();
  17. ds.executeUpdate("insert into user (login_id, password, email) value ('"+id+"','"+password+"','"+email+"')");
  18. %>
  19.  
  20.  
  21. <table align="center" border="0" width="100%">
  22. <tr><td class="titleheader">
  23.  
  24. you are successful registered</td></tr></table>
  25.  
  26. </body>
  27. </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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,434
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 295
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Registration Problem using Jsp

  #2  
Apr 11th, 2008
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
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.
Reply With Quote  
Join Date: Apr 2008
Posts: 1
Reputation: nazim_virani is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
nazim_virani nazim_virani is offline Offline
Newbie Poster

Re: Registration Problem using Jsp

  #3  
Apr 15th, 2008
Originally Posted by Beryl View Post
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@ page import="com.py.db.*, java.sql.*" %>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  8. <link rel="stylesheet" type="text/css" href="style.css">
  9. <title>Registration</title>
  10. </head>
  11. <body>
  12. <%
  13. String id = request.getParameter("login_id");
  14. String password=request.getParameter("password");
  15. String email= request.getParameter("email");
  16. DataSource ds = new DataSource();
  17. ds.executeUpdate("insert into user (login_id, password, email) value ('"+id+"','"+password+"','"+email+"')");
  18. %>
  19.  
  20.  
  21. <table align="center" border="0" width="100%">
  22. <tr><td class="titleheader">
  23.  
  24. you are successful registered</td></tr></table>
  25.  
  26. </body>
  27. </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+"')");
Reply With Quote  
Join Date: Jun 2007
Posts: 9
Reputation: sumit_indian has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 1
sumit_indian sumit_indian is offline Offline
Newbie Poster

Re: Registration Problem using Jsp

  #4  
Apr 16th, 2008
where had u call database its not visible in ur coding check your connection
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 197
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Registration Problem using Jsp

  #5  
Apr 16th, 2008
idiot. The answer has already been given and it's not what you say (as usual, you're wrong in everything you say).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JSP Forum

All times are GMT -4. The time now is 1:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC