Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic drop down menu, jsp

 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
I have written a piece of code to dynamically include data in the drop down list after querying the data base. I can print the values using out.print().. but they do not show up in the drop down list. Below is the code. Please lemme know the mistake in my code. Thanks you!


[ August 14, 2004: Message edited by: Hari priya ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hari,
The idea is to wrap each one in an <option> tag. For your example,

Also note that in some older browsers the extra out.print statements could mess up the output display.
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne -

Thanks for your reply. It still doesn't work. I am able to print the values using out.print(num.intValue()) [without using the form, select or options tag]. However, I am unable to capture the values in the drop down list [I do not have any out.print stmts now], I could not see the values.

The drop down list should contain two values 10001 and 1. Is the number of digits making any difference? Thanks!
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -

My code works fine. I gave "options" instead of "option"

Thanks you!
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Time to Try Struts :-)


In general you can yuse any collection of java beans to shows the properties. Check the reference guide on

http://struts.apache.org/userGuide/struts-html.html#select
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64850
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adopting a behemoth like Struts is a bit of overkill to implement a simple dynamic dropdown list. A custom action to dynamically populate the options list would be but a few lines of code.
[ August 16, 2004: Message edited by: Bear Bibeault ]
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not good pracise to make a cutom action for the popilating of the collection. Custom tag can greatly fit to this role



 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for all your contributions!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64850
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s not good pracise to make a cutom action for the popilating of the collection. Custom tag can greatly fit to this role


What are you talking about? They are the same thing.
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you talking about? They are the same thing.
Please use correct terms because in the sense of struts action means a subclass of the
org.apache.struts.action.Action
I have never heard that somebody used term "Custom Action" to the custom tags.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64850
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never heard that somebody used term "Custom Action" to the custom tags.


Perhaps you should get a copy of the JSP Specification. "Custom action" is the official and correct term for what is colloquially called a "custom tag".

The fact that Struts uses the term 'action' to mean something different is an unfortunate name collision.
[ August 16, 2004: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic