• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling funtion by clicking buttons

 
kashif iftikhar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created a button(Delete).
<input type=button name=del value=delete>
now i want when i click this button the deleteRec() funtion of my utility class called which delete a record from database.and the current page reloaded.
like this..
<% Delete obj = new Delete();
obj.deleteRec(-,-);
%>
how could i do this ?

------------------
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Client and Server side code.
The button gets shown on the client and can only execute client side code (javascript).
The code required to remove a record from the database happens on the server.
What you need to do is have the button (on the server side) send a message (HTTP request) to the server with the details required to perform the db operation then return a response to the client.
Does this clear it up?
Dave.
 
kashif iftikhar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes , i have done something like this.
1. put a hidden field in the form.
2. when yhe user click the button value set to "delete".
3. and then make a connection to the database.
4. get reference to the EJB Home.
5. call obj.remove() method to remove selected data.


------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic