wood burning stoves*
The moose likes Struts and the fly likes HashMap Display Default value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "HashMap Display Default value" Watch "HashMap Display Default value" New topic
Author

HashMap Display Default value

naval kumar
Ranch Hand

Joined: Jul 08, 2012
Posts: 37
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

Joined: Jul 23, 2008
Posts: 296

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

Joined: Jul 08, 2012
Posts: 37
please can you given me example ??
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

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

Joined: Jun 25, 2010
Posts: 5
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

Joined: Jul 08, 2012
Posts: 37
Thanks A lot jatan bhavsar
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

This gives a really good feeling.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HashMap Display Default value