Hi, I have got a basic question. I am connecting to a database through a servlet and displaying a table. What I need to do is have three buttons at the bottom of the table like "ADD", "DELETE" "MODIFY". I am wondering how I can add buttons to the HTML page through the servlet and how to capture the actions of each button when clicked like when "ADD" button is clicked it should pass control to a servlet "add.java". If anyone could throw me some light or atleast point me in the right direction that would be great. Thanks Chak
Another way that i will do is to associate a hidden field with each form element. Then set the action of the form to the same servlet and check which hidden values is passed.For example
<Form method="post" action="yourservlet_paht"> <Input type="submit" value="Add"> <Input type="hidden" name="action" value="Add"> </Form> <Form method="post" action="yourservlet_paht"> <Input type="submit" value="Modify"> <Input type="hidden" name="action" value="modify"> </Form> <Form method="post" action="yourservlet_paht"> <Input type="submit" value="Delete"> <Input type="hidden" name="action" value="delete"> </Form> In servlet use request.getParameter("action"), then use .equals() method to check the string value to determine which action to employ. Hope this help.