I have my environment setup nicely using Scala, StringTemplate within the Google AppEngine. I am having trouble looping through a Map and getting it to display in the template. When I assign a simple List of just Strings to the template it works using:
In Scala Servlet:
var photos = List[String]()
//... get photo url and title ...
photos = photo_url :: photos
template.setAttribute("photos", photos: _*)
In Template:
$photos: { photo|
<div><img src="$photo$_s.jpg"></div>
}$
The above works. However, any attempt of creating a Map using url and title and assigning to the template gives me an error. Here is my attempt, which does not work:
In Scala Servlet:
var photos = List[Map[String,String]]()
//... get photo url and title ...
photos = Map("url" -> url, "title" -> title) :: photos
template.setAttribute("photos", photos: _*)
In Template:
$photos: { photo|
<div><img src="$photo.url$_s.jpg" title="$photo.title$"></div>
}$
This gives me the following error
Class scala.collection.immutable.Map$Map2 has no such attribute: title in template context
Thoughts / Ideas ?