• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

How a servlet can know the cell selected in a table on a html form contained in a JSP page?

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

I have a JSP page in which there is an html form , and in this form there is a html table of 10 rows and 3 columns. When this JSP page is displayed in the browser of the user, I would like that when the user selects a cell in the table, a POST is sent to a servlet so that a processing is done in a database , based on the position of the cell. My problem is that I don't know how to write the code for the html table so that when the user selects a cell in the table, the servlet to which the form is posted is able to know the position of the cell( the position of the cell means, for me, the row and the column to which the cell belongs).
Please, how to solve my problem?

Thanks you in advance for your help.
 
Sheriff
Posts: 67735
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
Include the position information in hidden inputs.
 
John-Philippe Verger
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks you Bear Bibeault for the reply. But, please ,can I have more concrete information on how to put hidden inputs in the code for the html table?
 
Bear Bibeault
Sheriff
Posts: 67735
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
Not without more information on your part. You just need to make sure that whatever is triggering the submission of the form fills in the hidden inputs with the appropriate values. Probably some JavaScript needs to be involved.
 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John, can you describe more about your problem

You said that, user selects a cell, how can a client select a html table cell, are you using any checkbox in it?

One more thing is, you mentioned that when a user select a cell a POST request is sent to a servlet, are you using AJAX? or are you using a form button to call the servlet?
 
Bear Bibeault
Sheriff
Posts: 67735
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

anusha chaitanya wrote:One more thing is, you mentioned that when a user select a cell a POST request is sent to a servlet, are you using AJAX? or are you using a form button to call the servlet?


What does any of that matter? Regardless of how the request is generated "cell info" is not the type of information that is available unless something is done to provide it.
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic