Skip to content

Instantly share code, notes, and snippets.

@stephanos
Created July 9, 2012 16:06
Show Gist options
  • Select an option

  • Save stephanos/3077359 to your computer and use it in GitHub Desktop.

Select an option

Save stephanos/3077359 to your computer and use it in GitHub Desktop.
def load2(id1: String, id2: String) = Action {
try {
val dir = if (id1 == null) "" else id1.replaceAllLiterally("-", "_") + "."
val file = id2.replaceAllLiterally("-", "_")
val c = Class.forName("views.html.slides." + dir + file)
val m = c.getMethod("render")
Ok(m.invoke(null).asInstanceOf[Html])
} catch {
case e =>
Ok(views.html.error.notfound())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment