473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to save the data to the database

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="text/html;charset=windows-1252"%>

<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.lang.Object.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>

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

</head>
<body>

<Script>
var INPUT_NAME_PREFIX = 'inputName';
var TABLE_NAME = 'tblSample';
var headerRows;

window.onload=fillInRows;

function fillInRows()
{
headerRows = document.getElementById(TABLE_NAME).rows.length;
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(val)
{
var tbl = document.getElementById(TABLE_NAME);
var nextRow = tbl.rows.length;
var iteration = nextRow - parseInt(headerRows) + parseInt(1);

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

// CONFIG: This whole section can be configured

// cell 1 - select WBS code
var cell1 = row.insertCell(0);
var cb0 = document.createElement('input');
cb0.setAttribute('type', 'text');
cb0.setAttribute('size', '10');
cb0.setAttribute("name","wbscode");
cb0.setAttribute("id","lesslength");

cell1.appendChild(cb0);

// cell 2 - input text Start Time
var cell2 = row.insertCell(1);
var txtInp = document.createElement('input');
txtInp.setAttribute('type', 'text');
txtInp.setAttribute('name', INPUT_NAME_PREFIX + iteration);
txtInp.setAttribute('size', '10');
cell2.appendChild(txtInp);
row.myRow = new myRowObject(cb0,txtInp); }


</Script>
</head><body>

<form action="#" method="post" name="f1" onSubmit="return 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="addRowToTable();" 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 7641
dmjpro
2,476 2GB
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 Expert Mod 8TB
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
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 Expert Mod 8TB
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
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...
4
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...
2
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: ...
5
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...
5
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...
0
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...
1
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...
6
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...
1
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.