Charles White
Charles White

Reputation: 21

Trying to populate list using scala and lift

I am trying to populate a list using scala and lift and am getting a class not found exception. The code is directly out of the Lift in Action book.

Here is the snippet code with dummy data included which is what should be getting displayed.

import scala.xml.NodeSeq
import net.liftweb.util.Helpers._
object Library {
  case class Book(name: String)
  case class Author(name: String, books: List[Book])
  val books = List(
    Author("JK Rowling", List(
      Book("Harry Potter and the Deathly Hallows"),
      Book("Harry Potter and the Goblet of Fire"))
    ),
    Author("Joshua Suereth", List(
      Book("Scala in Depth"))
    )
) }
class Authors {
def list =
    "ul" #> Library.books.map { author =>
      ".name" #> author.name &
      ".books" #> ("li *" #> author.books.map(_.name))
   }
}

Here is the HTML code which should display a list of authors with their books.

<ul lift="authors.list">
  <li><span class="name">Author</span>
    <ul class="books">
      <li>Book title</li>
    </ul>
  </li>
</ul>

When I run I get this error:

Error processing snippet: authors.list 
Reason: Class Not Found 

Any ideas as to what is going wrong?

Upvotes: 1

Views: 134

Answers (1)

randbw
randbw

Reputation: 500

authors requires a capital A to match the object name.

Must be

<ul lift="Authors.list"> ... </ul>

Upvotes: 1

Related Questions