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

Sending checkbox value to two different servlet page

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a jsp page in which i had two button delete and update ,
The user select checkbox and after clicking delete button record are deleted from database for which i had defined servlet which is working fine it is getting value of check box as i had define form action to call delete servlet. the input type of delete button is submit.

Q) How can i pass value of check box from same jsp page to another servlet where i can update my record ,
Q) How can i had two submit button on same page OR how to submit checkbox value without using submit button to servlet

My JSP code
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nitin Belaram wrote:
Q) How can i pass value of check box from same jsp page to another servlet where i can update my record ,
Q) How can i had two submit button on same page OR how to submit checkbox value without using submit button to servlet



You can have several buttons (of type "button") and submit them through Java Script function when clicked. Or if you don't want to submit the hole page you may send the data through AJAX.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nitin,

Q) How can i pass value of check box from same jsp page to another servlet where i can update my record ,



Update: you to have all the values from the screen along with checkbox value to the UpdateServlet.
(Similar way you have done in Delete Servlet).

Q) How can i had two submit button on same page OR how to submit checkbox value without using submit button to servlet



Yes you can have two Submit Buttons.

Create a hidden parameter say userSelect within the form.
Set the value for userSelect when the user selects either Delete/Update.

Without submit button; tell me at what user event you want to pass the values of the screen to servlet.

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

Mohamed Inayath wrote:Nitin,

Q) How can i pass value of check box from same jsp page to another servlet where i can update my record ,



Update: you to have all the values from the screen along with checkbox value to the UpdateServlet.
(Similar way you have done in Delete Servlet).

Q) How can i had two submit button on same page OR how to submit checkbox value without using submit button to servlet



Yes you can have two Submit Buttons.

Create a hidden parameter say userSelect within the form.
Set the value for userSelect when the user selects either Delete/Update.



The JSP page code is fetching the record from database and displaying them in table, from where i can either delete the record or update them on the basic of checkbox.
Delete is working fine as i had define input type submit and form action as delete servlet.

But how can i update the record, on click of a button i want to pass empid to my servlet where i can call my update method defined in controller servlet.

Q) how does hidden parameter will work

Without submit button; tell me at what user event you want to pass the values of the screen to servlet.

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On onclick


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



try like this...
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic