Ad:
 
  • JSP Discussion Thread
  • Unsolved
  • Views: 1968
  • JSP RSS
Similar Threads
Feb 8th, 2010
0

jsp table and drop down menu

Expand Post »
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
smackdown90 is offline Offline
3 posts
since Feb 2010
Feb 8th, 2010
0

Re: jsp table and drop down menu

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
Moderator
Featured Poster
Reputation Points: 2229
Solved Threads: 587
Code tags enforcer
peter_budo is online now Online
5,027 posts
since Dec 2004
Feb 8th, 2010
0

Re: jsp table and drop down menu

Click to Expand / Collapse  Quote originally posted by peter_budo ...
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
smackdown90 is offline Offline
3 posts
since Feb 2010
Feb 9th, 2010
0

Re: jsp table and drop down menu

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"
Moderator
Featured Poster
Reputation Points: 2229
Solved Threads: 587
Code tags enforcer
peter_budo is online now Online
5,027 posts
since Dec 2004
Feb 9th, 2010
1

Re: jsp table and drop down menu

Click to Expand / Collapse  Quote originally posted by peter_budo ...
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 '&'
Featured Poster
Reputation Points: 741
Solved Threads: 364
Posting Maven
javaAddict is online now Online
2,665 posts
since Dec 2007
Feb 9th, 2010
0

Re: jsp table and drop down menu

thank you very much.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
smackdown90 is offline Offline
3 posts
since Feb 2010
Feb 9th, 2010
0

Re: jsp table and drop down menu

Click to Expand / Collapse  Quote originally posted by javaAddict ...
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.
Moderator
Featured Poster
Reputation Points: 2229
Solved Threads: 587
Code tags enforcer
peter_budo is online now Online
5,027 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: J2EE: How to inject a new POJO class in an app server
Next Thread in JSP Forum Timeline: 404 error





About Us | Contact Us | Advertise | Acceptable Use Policy
Build Custom RSS Feed


Follow us on Twitter


© 2010 DaniWeb® LLC