i have a JSP page page which contains a table with 5 columns. Three of the five columns contains dynamic values and the remaining two columns contain two buttons. the second column containing the dynamic value has a radio button associated with it with the value and the name of the radio button being the same as the dynamic column value. When someone selects a radio button and clicks the button in either the fourth or fifth column, i take them to the next page where i get to the know table row values in which the button was clicked by the selected radion button value which is the same as the dynamic value.
I want a method to find out the value of the items in the row the button was clicked without using the radio button. Is there any was i can achieve it ??
Yes, you can do that without using the radio button. How? Plenty way you can achieve. One way I usually use is : 1. insert a form in each row. (if u have 5 rows, it means 5 form) 2. put one hidden fields contain the different values in each row 3. when someone clicked the button, in the next page, you'll know where the submit is came from (from which line the submit is came from)
i give you some eg.
Hope this can help you
Java and Linux...<br />That's The Power.
Joined: Jun 02, 2004
thanks for your help and the example you provided, but i am still not clear you would find out on the next page which button was clicked. I would appreciate if you could explain.
Am I right in thinking you have something like the following?:
You want to know how your second JSP will know which row in the table was selected, i.e. which button was pressed, to allow you to perform the required action on the appropriate data.
Dicky's solution is an alternative but something inside me balks at the idea of having a separate form for every row of a table (I don't actually think it's valid HTML). The way the solution works is that your second JSP will only receive, as request parameters, the fields from the selected row, submitted via the hidden form fields.
At least that gives you some options. Perhaps someone else can offer a better solution?