• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HashMap Display Default value

 
naval kumar
Ranch Hand
Posts: 37
  • 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;" >
<htmlptions 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 ???

 
jatan bhavsar
Ranch Hand
Posts: 299
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: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please can you given me example ??
 
jatan bhavsar
Ranch Hand
Posts: 299
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...
 
Abhinav Kansal
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: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks A lot jatan bhavsar
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This gives a really good feeling.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic