Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

HashMap Display Default value

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
This gives a really good feeling.
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic