• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

access rows from html table

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,

Appreciate if someone can tell me the following:

Ways to access rows(cells) from a multiple rows html table on a jsp.

I am currently writing a simple jsp application which will perform update operation to the database. The system allow user to select any row from a html table (by using a checkbox), make some changes to any of the fields of the selected row and update the changes to the database.

Thanks,
[ November 29, 2005: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must be having text boxes and checkboxes in the row.
When you send it to the server, an array of the each of the objects is created. For checkbox there will be an array.
Hopefully when you submit the page, the array gets sent.
You then do a
request.getParameterValues("THE_CONTROL_NAME")
and get it in a string array.
Then use the string array to update in the Database.
Hope this helps
 
Terence Chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, thanks for your reply!

I am still not quite get it! Could you give me a code example?

P.S.
I have a table of many rows dynamically created and retreived from the database and my questions are:

How can I get the user selected row from the table (HTML)?

How can I get the fields of the same row from the table(HTML)?
Example,
user selected row 3 by checking the checkbox on row 3 and I want to get the whole row 3 data and update the data to the database!

Do I need to wrap the table with the form and label each row with a id?

Thanks!
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each checkbox should identify the primary key of the row. If the row data can be edited, each data element must be displayed in a form control. You can't just modify raw text emitted to an HTML page,
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic