retrieving multiple values for a key in a properties file

View: New views
3 Messages — Rating Filter:   Alert me  

retrieving multiple values for a key in a properties file

by A. Maza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

is it somehow possible to retrieve a String array (or a list or
something else) for multiple values in a properties file.

I want to achieve something like this:

I have a properties file with the following entry

myKey=firstValue,secondValue,thirdValue,...

in a component I would need to retrieve an array or collection for this
in a similar approach than doing getLocalizer().getString(...) for a
single-valued property.

Of course, I could split the retrieved String every time accessing the
property but this is not really an option.

Is there any way to do this in wicket?

thanks,
andr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: retrieving multiple values for a key in a properties file

by Newgro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am 17.12.2009 21:47, schrieb A. Maza:

> Hello,
>
> is it somehow possible to retrieve a String array (or a list or
> something else) for multiple values in a properties file.
>
> I want to achieve something like this:
>
> I have a properties file with the following entry
>
> myKey=firstValue,secondValue,thirdValue,...
>
> in a component I would need to retrieve an array or collection for
> this in a similar approach than doing getLocalizer().getString(...)
> for a single-valued property.
>
> Of course, I could split the retrieved String every time accessing the
> property but this is not really an option.
>
> Is there any way to do this in wicket?
>
> thanks,
> andr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
This is not really a wicket task. It's more a programming problem.

String localizedString = Localizer.getString(key);
String[] values = localizedString.split(",");

Simple isn't it? You really want to decline this method? Another way
would be an enumeration of values
and i18n every single value. Could be hard if you have many different keys.

Cheers
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: retrieving multiple values for a key in a properties file

by A. Maza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>>
> This is not really a wicket task. It's more a programming problem.
>
> String localizedString = Localizer.getString(key);
> String[] values = localizedString.split(",");
>
> Simple isn't it? You really want to decline this method?

I was aware of this possibility (which I actually want to avoid for my
front page) ;-) I just wanted to ask if there is a standard way to do
this in wicket in order to leverage also the caching mechanism.

But it is no problem to implement it on my own.

regards,
andr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...