473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to know which button is clicked in JSP

14
Hi,

I am using a JSP in my application. In JSP page I created tables and buttons inside a loop.
Expand|Select|Wrap|Line Numbers
  1. <%  
  2.        i=0;
  3.        while(i<4) {
  4. %>
  5.   <table align="left" width="100%">
  6.    <tr>
  7.         <td>
  8.          <%
  9.     out.print("SNo. " + (i + 1));            
  10.         %>
  11.             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                                     
  12.          <input type="submit" name="name" value="Click">
  13.         </td>        
  14.     </tr>
  15.     <tr>
  16.        <td> 
  17.         <% 
  18.                out.print("ABC");
  19.          %> 
  20.        </td>
  21.      </tr>
  22.   </table>
  23. <%   
  24.        }
  25. %>
  26.  
My problem is -- when any one of the 4 buttons was clicked how can I find which button was clicked, so that I can get the SNo associated with it.

Is there any way to find the button which is clicked?

Thanks in advance,
Tiijnar
Dec 11 '08 #1
1 5847
r035198x
13,262 8TB
You have 4 buttons each with the same name "name" and same value "Click". Use that index i to name your buttons and values as well.
Dec 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
1
by: Lee David | last post by:
I have a page that has menu buttons on it. There are regular, over and down images that I swap. The problem is I can't seem to get the buttons to stick. So if I click the "News" image, that page...
1
by: DotNetMania | last post by:
panel has not Key press event... that's why.. if i have to figure invoking any event out when panel clicked it is so difficult...what button is clicked .... button of Mouse like .. Left,...
3
by: leon | last post by:
hello friends, i am writing a page aspx and creating controls dinamicaly and then i must to create for each control the events as well. Anybody to know how????? happy day lion
7
by: Amadelle | last post by:
Hi all and thanks in advance, I am stuck! I can't figure out how to identify which button was clicked on my ASP.NET page in the PostBack event? So what I am trying to do is to is to have an if...
3
by: Chris Dunaway | last post by:
I have derived a class from the System.Windows.Forms.Button class in order to draw the button differently. Among other things, I paint the background of the button in the OnPaing override. ...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
3
by: AlecL | last post by:
Hi All, I am trying to capture the value of a textbox as a result of a button click event in a repeater, but it can't find the textbox. Here is what I am trying to do in the code for the click...
2
by: damonjulian | last post by:
hi ,i created 3 buttons such that if button1 is clicked it will disable button2 ,and clicking button3 will restore state of button2 to normal, to my dismay i find that button2 still responds to...
5
by: Charles May | last post by:
I have a form that creates a button for each employee in the database. I have added the click handler and have this working. The buttons contain the employee's name for their respective .Text and I...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.