• Post Reply Bookmark Topic Watch Topic
  • New Topic

need connectivity between radio button and servlet file to delete record from database.

 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I want to delete the previously entered record from the database when I click on radio buttons. can any oneplease help me how to link the radio butten and database ??


This is my servlet code.






This is my HTML code.

<html>
<head>
<title>Data insertion form</title>
</head>

<body>

<form method= "get" action="/datainsert/DataInsertTable">

<h1><center>Enter the required information</center></h1>

<table>
<tr>
<td>Name</td>
<td> :- </td>
<td><input type="text" name="name"></input></td>
</tr>

<tr>
<td>Roll Number</td>
<td> :- </td>
<td><input type="text" name="roll"></input></td>
</tr>

<tr>
<td>Class </td>
<td> :- </td>
<td><input type="text" name="clas"></input></td>
</tr>

<tr>
<td>Mobile Number </td>
<td> :- </td>
<td><input type="text" name="mono"></input></td>
</tr>

<tr>
<td></td>
<td><input type="submit" value="Submit" width="16"></input></td>
</tr>

</table>


</form>

</body>
</html>
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A radio button isn't really a good choice for that kind of function. Radio buttons are intended for a situation where you are choosing one of several options, excluding the other options. It's essentially an alternative version of the single-selection dropdown list.

More commonly you'll see people doing something like a set of checkboxes plus a "delete" button.

In any event, HTML does not support direct action from clicking on a radio button. To get the server to take an action, you have to submit a form or a URL.

You can do what you are asking (although it's not what I would do). But to do it, you'd have to attach a JavaScript onClick handler to the radio button and make it force a form submit.

As a side note, it's also best not to directly acquire database connections when designing J2EE webapps. Use a Connection Pool instead.
 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:A radio button isn't really a good choice for that kind of function. Radio buttons are intended for a situation where you are choosing one of several options, excluding the other options. It's essentially an alternative version of the single-selection dropdown list.

More commonly you'll see people doing something like a set of checkboxes plus a "delete" button.

In any event, HTML does not support direct action from clicking on a radio button. To get the server to take an action, you have to submit a form or a URL.

You can do what you are asking (although it's not what I would do). But to do it, you'd have to attach a JavaScript onClick handler to the radio button and make it force a form submit.

As a side note, it's also best not to directly acquire database connections when designing J2EE webapps. Use a Connection Pool instead.



Thank you for the reply,
but would you please help me to get the solution on my way?
Would you please suggest and explain me the changes needed ??


Waiting for your kind reply
Thank you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!