<%@ 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?

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

<%@ 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+"')");

where had u call database its not visible in ur coding check your connection

idiot. The answer has already been given and it's not what you say (as usual, you're wrong in everything you say).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.