Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Sending checkbox value to two different servlet page

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • 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: 4107
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
On onclick


 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



try like this...
 
Hug your destiny! And hug this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic