views:

49

answers:

1

Hi

Is it possible to use ui:msg with a Dictionary or a custom HashMap in GWT? If so how?

Thanks A

A: 

Dont know if that is possible, but what you can do is using POJO's.

like:

<ui:with type="org.mypackage.MyMessages"
    field="messages" />
<g:Label text="{messages.hello}" />

Where MyMessages is a class containing a method getHello() which returns a string. So you will be wrapping the dictionary inside the class MyMessages

pathed
Exellent! Thanks for the reply. Will see if i can get it working with a map like so: <g:label text="messages.get('key')" /> then you wouldnt have to have a method for every message but only a map with keys and texts.
Andreas Blomqvist
Btw how do I format the code in posts like you have here at stackoverflow?
Andreas Blomqvist
You have a button for that, just select you code and press the '101010' button
pathed