0

i want to create dynamic table and drop down menu from lists.
i have 2 questions:
1. for the drop down menu i can run over the list and write the tag <option> inside the loop? it will create the menu with the number of items in the list? there is another way?
2. i am planning to build the table the same way with a loop.
but i want to know how can i get a selected row from the table.
if i have a link in every row how can i know which row was selected?

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by peter_budo
0

1. for the drop down menu i can run over the list and write the tag <option> inside the loop? it will create the menu with the number of items in the list? there is another way?

Yes there can be other ways, but in this case it is most simplest and efficient way

2. i am planning to build the table the same way with a loop.
but i want to know how can i get a selected row from the table.
if i have a link in every row how can i know which row was selected?

Not sure what you are attempting to do, but you can provide each row tag "tr" with unique id and use jQuery to handle clicks and return selections. Or there is always option of using buttons/checkboxes/radioboxes for each row. As I said, not knowing your requirements makes it difficult to advice

0

Yes there can be other ways, but in this case it is most simplest and efficient way

Not sure what you are attempting to do, but you can provide each row tag "tr" with unique id and use jQuery to handle clicks and return selections. Or there is always option of using buttons/checkboxes/radioboxes for each row. As I said, not knowing your requirements makes it difficult to advice

thank you for the answers. i will try to explain my self better.
i want to create a table and in each row there will be a link.
when a user clicks on a link it will go to a servlet and i want to send the selected row to the servlet. how can i do that?

0

Correct me if I'm wrong, but aren't data in the table first populated by servlet?
If it so then you have some unique IDs you can reuse for creating links with call for servlet plus additional parameter which in this case would be some unique ID, for example book shop would use ISBN as this unique and hyperlink would be as "www.bookshop.com/ServletCall.jsp&itemId=1234"

1

Correct me if I'm wrong, but aren't data in the table first populated by servlet?
If it so then you have some unique IDs you can reuse for creating links with call for servlet plus additional parameter which in this case would be some unique ID, for example book shop would use ISBN as this unique and hyperlink would be as "www.bookshop.com/ServletCall.jsp&itemId=1234"

I am sorry for replying to this, but shouldn't it be like this:
"www.bookshop.com/ServletCall.jsp?itemId=1234"
instead of a '&'

Votes + Comments
Well spotted. Thank you!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.