473,776 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to save the data to the database

18 New Member
Hi all,
I have a problem in my project. I have developed a small page like this. Now after the save button is clicked, the data which is entered should be stored in the database. I'm attaching the code here please if someone find the solution send me as soon as possible.

<%@ page contentType="te xt/html;charset=wi ndows-1252"%>

<%@ page import="java.sq l.*" %>
<%@ page import="javax.s ql.*" %>
<%@ page import="java.la ng.*" %>
<%@ page import="java.la ng.Object.*" %>
<%@ page import="java.io .*" %>
<%@ page import="java.ut il.*" %>

<html><head><ti tle>Time Sheet Entry</title>

</head>
<body>

<Script>
var INPUT_NAME_PREF IX = 'inputName';
var TABLE_NAME = 'tblSample';
var headerRows;

window.onload=f illInRows;

function fillInRows()
{
headerRows = document.getEle mentById(TABLE_ NAME).rows.leng th;
addRowToTable() ;
}

// CONFIG:
// myRowObject is an object for storing information about the table rows
function myRowObject(one , two) {
this.one = one; // text object
this.two = two; // input text object

}

function addRowToTable(v al)
{
var tbl = document.getEle mentById(TABLE_ NAME);
var nextRow = tbl.rows.length ;
var iteration = nextRow - parseInt(header Rows) + parseInt(1);

// add the row
var row = tbl.insertRow(n extRow);

// CONFIG: This whole section can be configured

// cell 1 - select WBS code
var cell1 = row.insertCell( 0);
var cb0 = document.create Element('input' );
cb0.setAttribut e('type', 'text');
cb0.setAttribut e('size', '10');
cb0.setAttribut e("name","wbsco de");
cb0.setAttribut e("id","lesslen gth");

cell1.appendChi ld(cb0);

// cell 2 - input text Start Time
var cell2 = row.insertCell( 1);
var txtInp = document.create Element('input' );
txtInp.setAttri bute('type', 'text');
txtInp.setAttri bute('name', INPUT_NAME_PREF IX + iteration);
txtInp.setAttri bute('size', '10');
cell2.appendChi ld(txtInp);
row.myRow = new myRowObject(cb0 ,txtInp); }


</Script>
</head><body>

<form action="#" method="post" name="f1" onSubmit="retur n checkDate(this) ;">

<center>
<table border="1" id="tblSample" class="sample">
<tr>
<th >Name</th>
<th >Company</th>
</tr>
</table>

<input type="button" value="Add" onclick="addRow ToTable();" class="button" />
<input type="submit" value="Save" class="button" />
<input type="button" value="Exit" onclick="window .close();" class="button"/>
</center>
</form>
</html>
May 23 '07 #1
4 7668
dmjpro
2,476 Top Contributor
Welcome to TSDN.

it is better to ask this Q. in JAVA forum.
experts r there.

kind regards.
dmjpro.
May 23 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
You won't be able to save the data in a database with javascript. Do you want this saving to appear client-side (in other words, the page is not refreshed/reloaded) or does it not matter if another page deals with saving the data? If its client-side, then you want ajax. If it's a new page, you want JSP.
May 23 '07 #3
anilareddy
18 New Member
You won't be able to save the data in a database with javascript. Do you want this saving to appear client-side (in other words, the page is not refreshed/reloaded) or does it not matter if another page deals with saving the data? If its client-side, then you want ajax. If it's a new page, you want JSP.
how to include a jsp page fron javascript? It shud go to jsp and control shud come back to js? how is it possible?
May 29 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
how to include a jsp page fron javascript? It shud go to jsp and control shud come back to js? how is it possible?
Create a jsp page that you will make a request to using javascript.

Learn about AJAX by checking out the tutorial links in the Offsite Links sticky thread.
May 29 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
25031
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or less complex technical calculations, several input variables. I would like to equipp the starting panel with the usual New, Open, Save, Save As, Close etc. menus (like in Excel, or Word, etc.) What is the best way to accomplish Save, or Save As?...
4
3003
by: Luis | last post by:
Hi, I can a big problem... because I have a byte data = new byte, and I need to save this to a field on my MySQL database (here I have a BLOB field) but ¿can I save it? because if I put: Insert into archiv(ref, databinary) VALUES('"+ref+"', '"+ data+"') In my Database only save "System.byte" Can Someone help me?
2
1899
by: buran | last post by:
Dear ASP.NET Programmers, I am saving the tables of a dataset into an XML file. I want to save the XML file into the database, then retireve it as a dataset. I use the following code: ds.WriteXml("C:\Inetpub\wwwroot\database2\richtext\burak.xml") where ds is my dataset.
5
2594
by: \A_Michigan_User\ | last post by:
I'm using asp.net/vb.net/ado.net to create a very simple user interface. (Everything works if I use STATICALLY created textBoxes... but not when I make them DYNAMICALLY.) 1. Execute a SQL SELECT cmd to retrieve a record. 2. Loop through the dataReader values, creating textBox boxes dynamically, adding them to a Panel. (The database values are placed in these textboxes.)
5
2664
by: C Watson | last post by:
Hi, I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very specific feature that I would like to use it for. I have a rather long form that the users use to enter data during a phone call with a client. Since it's long, I put six Save buttons down the length of the form and asked the users to save often. When they click the Save buttons, the data is saved to a central database and a text label is changed to say...
0
2412
by: amrhi | last post by:
Hy Guys , Can anybody help me ? I try to make small web database in my unit. Some of fields have on change behaviour to get other data that automatically filled other text field. But when i try to hit "enter" after i fill text field , its automatically save data in my table database . I just want to save data after , i click "save" button. <?php include"session.php"; mb_http_input("iso-8859-1"); mb_http_output("iso-8859-1"); $tgl=$_POST;...
1
3733
by: Rameel | last post by:
Friends, I'm probably being more critical with VB.Net Windows application. I have Developed VisualStudio 20005 VB.Net Windows application how willl i be able to save a specific record into my database file throu GUI Save Record button? As i write the comand as foloow but it is not inserting the new record in to the Access Database. Public Function Open_Connection() As Boolean Try Select Case...
6
4143
by: Josetta | last post by:
Access 2003 I've been experiencing some problems with my "monster" database the last couple of days. I imported all objects into a new database yesterday, which pretty much stopped the crashing problems, but here's something weird: Whenever I copy an object (reports so far), I am able to open it and make changes, but when I try to save it (without closing), it appears to save (message box goes off), but it doesn't. Then, if I try to...
1
2615
by: TonyJ | last post by:
Hello! I'm using VS2005. I'm looking at ADO.NET and have found some test tutorial solution on microsoft MSDN. The one that I'm looking at now is called Walkthrough: Saving Data to a Database (Single Table) I have followed the walkthrought exectly but it doesn't work as expected.
2
3031
by: chike_oji | last post by:
Please can someone help me. I am writing a web application, that allows for the upload of an excel sheet into the database. I have an upload button and a save button. The upload button allows for the retrieval of the excel data into a DataTable, which is bound to a GridView for previewing before saving to the Database. But, whenever I click on the save button, I lose the DataTable's data, so I lose the data I want to save to the...
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10292
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.