• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Import whole table.

 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to make a servlet where I insert the whole table that I made on HTML page in my Oracle db.
I can insert elements individually, as all HTML tags have 'name' attribute. What should I do if I want to insert the whole table into the Oracle db I made.

Please give some idea.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "whole table"? The HTML making up the table on the page? Multiple fields? Can you give an example?
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is how the table works..




Now when am done inserting many such rows. I want to submit all data in my oracle db.

P.S : fname is my global variable and I have taken its value in another function.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's JavaScript.

So you want to then POST the changes to a servlet for insertion to Oracle?

WP
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the exact problem? If all the element are being POSTed to a servlet, simply retrieve the values, and send them to a model class that inserts the values into the DB.

Which part are you having problems with?
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the problem is, all the elements are just getting printed in my HTML file. There are no means to identify these elements individually or together for me to POST them in servlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything that you want to be posted must be a form element -- usually an <input> element of some kind (or textarea, select, et al).

Alternatively, you could write some JavaScript to grab simple text from table cells and encode that properly for POSTing via hidden inputs or via Ajax. But I'd only head down that road if the much easier input element approach is impossible for some reason.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. making the input elements readonly and styling them with CSS can make them look exactly like simple text and not editable, so appearance concerns are no barrier to using input elements.
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I'm unable to make the table by input as I want to add elements to it through Javascript.
Any idea, how its done?
Or how to POST a table to servlet to add it to oracle db.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Noopur Kore wrote:Actually I'm unable to make the table by input as I want to add elements to it through Javascript.

Using JavaScript in no way prevents you from using input elements. Why do you think so?

Or how to POST a table to servlet to add it to oracle db.

Again, you can't post a table. Period. End. Full stop.

You post form elements. Keeping asking for the impossible isn't going to get you anywhere.
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I got it.

Back to the former one.

I posted the javascript.
Here's the HTML code for my table which contains only headings.

<table id="table1">
<tr>
<th width="10%">Serial number</th>
<th width="20%">Field Name</th>
<th width="30%">Text</th>
<th width="10%">Font Name</th>
<th width="10%">Font Size</th>
<th width="10%">X Co-ordinate</th>
<th width="10%">Y Co-ordinate</th>
</tr>
</table>

The elements which i call to add a row to the table are coming from another <div> and this table is another <div>.
Can anyone help to separate these elements once I have added them to table??
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.

Looking at your "code", you may have to build a custom POST in JavaScript.

WP
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any ideas or hints for how to go about that?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic