954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

jsp table and drop down menu

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 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?

smackdown90
Newbie Poster
3 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 
1. for the drop down menu i can run over the list and write the tag 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 way2. 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

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 
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?

smackdown90
Newbie Poster
3 posts since Feb 2010
Reputation Points: 10
Solved Threads: 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"

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 
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 '&'

javaAddict
Nearly a Senior Poster
Team Colleague
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
 

thank you very much.

smackdown90
Newbie Poster
3 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 
I am sorry for replying to this, but shouldn't it be like this: "www.bookshop.com/ServletCall.jsp?itemId=1234" instead of a '&'


Ooops, $hit does happens specially if you use Mac with Ubuntu. Keyboard layout messed up, sorry for that.

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You