You can do a submission from the modified sample code.
It will echo back what has been submitted.
Main Topics
Browse All TopicsI have a dynamic table as code below.
i input data into text field and then I add rows .
How do i submit these records to the servlet ?
basically , i want to update these rows( records) in the database .
what to do now ?
can you update my jsp code and tell me how to get these records in the servlet ?
i don't know whether there is any other way exists .
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>>To get the data from Servlet or JSP
>>Row 1 data will be from: id1_1, id1_2, id1_3, id1_4
>>Row 2 data will be from: id2_1, id2_2, id2_3, id2_4
Can you show the Servlet code ? How does my servlet going to know , how many rows are coming ?
Description1 field will actually be a drop down box instead of a text box
I want to update my code so that it does not allow two duplicate rows by Description1 field in the dynamic table generated ...it will just show an alert box saying "No two row have duplicate Description1 field "
Where i need to modify my code to include this change ?
Hi cofactor,
Here how.
1. (Html) I created a new function call "CheckKey(value)"
this function ensure there is no duplicate in col1 &
this is call in the beginning of AddItem().
[Code in Snippet Window]
2. (JSP/Servlet) I have another JSP file which first search for
col1 key then extract row data.
[Code below]
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%
for (Enumeration e = request.getParameterNames(
{
String key = (String)e.nextElement();
// focus on key id?_1
String split[] = key.split("_");
if( split.length == 2 && split[1].equals("1") ) // check if this belong to col 1 data
{
// if yes found the subkey
String subkey = split[0];
String col1 = request.getParameter(subke
String col2 = request.getParameter(subke
String col3 = request.getParameter(subke
String col4 = request.getParameter(subke
// do somthing useful here
// doSomeHere(col1, col2, col3, col4);
out.println(col1+" | "+col2+" | "+col3+" | "+col4+"<br>");
}
}
%>
X'mas.....
Business Accounts
Answer for Membership
by: bluebelldiscoveryPosted on 2008-12-22 at 21:52:38ID: 23231585
Hi cofactor,
You can insert a hidden field beside the AddRow() function.
I make 3 changes to your code.
1. Define a variable to make the hidden field row unique
//////// NEW ////////
var id = 1;
//////// NEW ////////
2. Building the hidden field
//////// NEW ////////
c.innerHTML = i1 + "<input type='hidden' name='id"+id+"_1' value='"+i1+"'>";
c1.innerHTML = i2 + "<input type='hidden' name='id"+id+"_2' value='"+i2+"'>";
c2.align = "center";
c2.innerHTML = i3 + "<input type='hidden' name='id"+id+"_3' value='"+i3+"'>";
c3.innerHTML = i4 + "<input type='hidden' name='id"+id+"_4' value='"+i4+"'>";
id++;
//////// NEW ////////
3. Include a submit button
<input type="submit" value="Submit Now" />
To get the data from Servlet or JSP
Row 1 data will be from: id1_1, id1_2, id1_3, id1_4
Row 2 data will be from: id2_1, id2_2, id2_3, id2_4
You have to ignore
FIIt1, FIIt2, FIIt3, FIIt4
Select allOpen in new window