• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HashMap Display Default value

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear , I m setting in java all the countries in hashMap like this---
countryName = cnt.getStringProperty("COUNTRY_NAME");
oid = ""+cnt.getLongProperty("OID");
countries.put(countryName, oid)

and displaying the All countries in the drop down like

<html:select property="country" styleClass="comboStyle" style="width:200px;" >
<html:options collection="countries" property="value" labelProperty="key"/>
</html:select>

Now i want to display country "India" in dropdwon as default value how can i do it ???

 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Naval,

The value attribute of the <html:select> is use to compare the value...

value : The value to compare with for marking an option selected. [RT Expr] ..


Regards
Jatan
 
naval kumar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please can you given me example ??
 
jatan bhavsar
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Naval,

You need to specify the value attribute in <html:select> which will gives the selected value.


Hope you will find it helpful...
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything else is correct apart from the fact that values are being set in Java and HTML must have been placed in some JSP. To get that value, you would need to set that value in Request scope and use a $ to retrieve it on frontend.
 
naval kumar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks A lot jatan bhavsar
 
jatan bhavsar
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This gives a really good feeling.
 
reply
    Bookmark Topic Watch Topic
  • New Topic