• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

additional values in the dropdown

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am currently picking all the values for a dropdown from the database. I am creating an array list. But how do I add a value to the dropdown list which is not in the database, like "Select" I want this to be the first one in the list and the other values below this.
One way is while creating the arraylist, add the value Select to the array list.
But Is there any way I can handle this at the jsp level?
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't see how this relates to Struts. Just add more values to the ArrayList.
 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
Thats What I am doing now. But I want to use the same arraylist for some other business logic and would like it to contain only values from the database. SO I was wondering if struts allows me to add values other than that in the array list to the dropdown directly in the jsp page....
I have now:::
<html:select property="city" size="1" >
<html: options collection="cityList" property="value" labelProperty="label"/>
</html:select>
I would like :::
<html:select property="city" size="1" >
----add a dropdown value "select" here-----
<html: options collection="cityList" property="value" labelProperty="label"/>
----add a dropdown value "Other" here-----
</html:select>
[ December 03, 2002: Message edited by: Rajani Deshpande ]
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You need to code something for the value property, which should actually be part of your model.
<curse>Those smilies</curse>
[ December 03, 2002: Message edited by: Michael Zalewski ]
 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that worked,
i was initially using html:options instead of html:option and that was giving a weird error.
 
Replace the word "snake" with "danger noodle" in all tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic