aspose file tools*
The moose likes JSP and the fly likes Populating the value into dropdown box from .propertied file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Populating the value into dropdown box from .propertied file" Watch "Populating the value into dropdown box from .propertied file" New topic
Author

Populating the value into dropdown box from .propertied file

Nisha gowda
Greenhorn

Joined: Feb 23, 2010
Posts: 9
Hi,

I am new to jsp. My requirement is, there is a "test.properties" file with following content

country=US,UK,UAE

On my jsp page I need to create a dropdown box using the above test.properties file. i.e dropdown should show US, UK and UAE values.

I tried using resourcebundle and string tokenizer but couldn't succeed. Can somebody help me on this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

Be sure not to put any Java code in the JSP. In the controller, once you fetch and split the values into an array of strings, set that as a request scoped variable. In the JSP access that variable with the JSTL <c:forEach> tag to iterate over the string array and create the option elements.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nisha gowda
Greenhorn

Joined: Feb 23, 2010
Posts: 9
Thanks Bear,

I did it in service class which is used by controller and was able to populate dropdown with data from properties file
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating the value into dropdown box from .propertied file