Lift render different templates in controller -
i have next controller
object mycontroller extends resthelper { serve { case "name" :: name :: _ _ => if (name == "adam") { //should render template adam.html } else { //should render other.html } } }
how lift work it?
i'd think should able utilize this:
templates.apply("adam" :: nil) match { case full(ns) => xhtmlresponse(ns) case _ => notfoundresponse("404 - template not found") }
though, 2 things - if you're rendering pages - why not utilize lift's built in sitemap? handles lot of error conditions , such you. also, may want consider making 2 different rules, may easier follow later on this:
case "name" :: "adam" :: _ _ => //render adam.html case "name" :: _ :: _ _ => //render other
lift
No comments:
Post a Comment