Hello, everyone!
I am unsure whether this is the right place to post this question but here goes:
I cannot get Lift's lazy loading to work. The page always says "Loading" (or displays the ajax loading graphic if I provide it) and stays there indefinitely.
I made a minimal SBT project to test this. What am I doing wrong? The Lift demo on this seemed extremely simple and I searched everywhere but couldn't even find anyone having the same problem. I must be missing something obvious.
Relevant project files:
src/main/webapp/index.html:
<div data-lift="lazy-load">
<div data-lift="HelloSnippet"><span id="text"></span></div>
</div>
src/main/scala/lifttest/snippet/HelloSnippet.scala:
package lifttest.snippet
import net.liftweb.util.Helpers._
class HelloSnippet {
def render = "#text" #> "Hello!"
}
I am using an embedded Jetty server to run this:
src/main/scala/lifttest/Jetty.scala:
package lifttest
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.webapp.WebAppContext
object Jetty {
val webappPath = "src/main/webapp"
def main(args: Array[String]) = {
val server = new Server(9090)
val webapp = new WebAppContext()
webapp.setContextPath("/")
webapp.setDescriptor(s"$webappPath/WEB-INF/web.xml")
webapp.setResourceBase(webappPath)
server.setHandler(webapp)
server.start()
server.join()
}
}
And the other files in case I did something wrong there:
build.sbt:
name := "lift-test"
version := "1.0"
scalaVersion := "2.11.6"
libraryDependencies ++= {
val liftVersion = "2.6.2"
val jettyVersion = "9.2.10.v20150310"
Seq(
"ch.qos.logback" % "logback-classic" % "1.1.3",
"net.liftweb" %% "lift-webkit" % liftVersion,
"com.h2database" % "h2" % "1.4.186",
"org.eclipse.jetty" % "jetty-server" % jettyVersion,
"org.eclipse.jetty" % "jetty-webapp" % jettyVersion
)
}
src/main/webapp/WEB-INF/web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<filter>
<filter-name>LiftFilter</filter-name>
<display-name>Lift Filter</display-name>
<description>The Filter that intercepts lift calls</description>
<filter-class>net.liftweb.http.LiftFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LiftFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
src/main/scala/bootstrap/liftweb/Boot.scala:
package bootstrap.liftweb
import net.liftweb.http.LiftRules
import net.liftweb.sitemap.{SiteMap, Menu}
class Boot extends {
LiftRules.addToPackages("lifttest")
LiftRules.setSiteMap(SiteMap(Menu("Home") / "index"))
}
Thank you in advance,
Michal