0

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)
tantalum
  • 2,354
  • 1
  • 15
  • 22
  • Your code looks ok. It works for me when I try it. Do you have a test project somewhere? Also you can do: `val page = params.getAs[Int]("page").getOrElse(1)` – Stefan Ollinger Aug 31 '13 at 21:52
  • Sadly everyone says that it looks fine. I don't have the code any more because I switched to using Fink (A scalatra based CMS). – tantalum Sep 11 '13 at 20:36

1 Answers1

0

Try cleaning the temp/generated files via the following command

sbt clean clean-files

Then start the Jetty server. It might help.

itsraghz
  • 857
  • 1
  • 11
  • 25