This is a sample of my table
CREATE TABLE elements (
elementname,
displaytext
)
How do i use jpa and populate hashmap so that i can pass this down to view from controller
HashMap<String, String> hm = new HashMap<String, String>();
render(hm);
and in view i want to iterate through and get displaytext based on element name
Not 100% sure if this is an overkill or if an easier way exists. Came across this article
UPDATE1:
Play frame work 1.2.4
I don’t think you need a Map for this but just a list of elements. If I am wrong explain more clearly what you are trying to achieve.
1rst Solution
Your Model:
In your controller:
In your view:
2nd Solution
Otherwise if you need an actual map you can use the model above and populate the map in your controller:
view:
3rd Solution
Create a container for your map:
Controller: