• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

retrieve values specific to a row

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

I'am displaying a table in a jsp with different with a button in each row with the same value. I' am calling all the action in the servlet. Now on submit I need to update the rows in the database and the page. i' am passing a hidden field with the id of each row after every button in the jsp. When i call the action in the servlet, it is taking the id of the first record and updating it. I' am unable to call the action on a specific record and update it. Please help me how to do it.

Thanks in advance,

regards,
Komal
 
Sheriff
Posts: 67753
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
Give the button the value that represents the id for the row.
 
Komal Amaresh
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

That dosen't seem possible. As the value is what that is displayed in the page. I tried passing the value to the name and id attributes, but even that was not helping as request.getparameter needs to specified to call an action and it was not possible to retrieve the value prior to the action, but I used js to pass the value onclick to the form calling the value on action in the url. That worked.
Thanks a lot.

regards,
Komal
 
Komal Amaresh
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Yes, though I could use js to resolve it, I still would like to know if there is a way to do it on the server side.
I tried the following way.

The above code in the jsp when called in the servlet is retieving the first record's id.
I doubt passing an int to the name of the button will help as follows.
In the jsp, I set the values as follows.

In the servlet....


How can I do it?

thanks and regards.
Komal
 
We don't have time for this. We've gotta save the moon! Or check this out:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic