scalate scalatra NoValueSetException with jade

301 views Asked by At

I'm using Scalatra with Scalate and Jade. When ever I try to apply a template that takes values the values are not being applied to the template and I'm getting a NoValueSetException... Here is the code I have:

// --------- In PostsServlet ------------------
get("/:page") {
  /*
  val page:Int = params.getOrElse("page", "1").toInt
  val posts = PostCollection.page(page)
  */
  contentType="text/html"
  jade("/index.jade", "foo" -> "bar")
}


// ------------------ In index.jade ----------------------
-@ var foo : String

-attributes("title") = "Circuits Of Imagination"
-attributes("headline") = "Writings"

and the exception:

The value for 'foo' was not set
org.fusesource.scalate.NoValueSetException: The value for 'foo' was not set
at org.fusesource.scalate.RenderContext$$anonfun$attribute$1.apply(RenderContext.scala:159)
at org.fusesource.scalate.RenderContext$$anonfun$attribute$1.apply(RenderContext.scala:159)
at org.fusesource.scalate.RenderContext$class.attributeOrElse(RenderContext.scala:167)
1

There are 1 answers

0
itsraghz On

Try cleaning the temp/generated files via the following command

sbt clean clean-files

Then start the Jetty server. It might help.