1
Ich beginne Lift zu lernen und ich stecke fest. Ich habe Problem mit einfachen Snippet:Lift: Wie kann ich den aktuell angemeldeten Benutzer abrufen?
class Util {
def in(html: NodeSeq) : NodeSeq ={
if (User.loggedIn_?)
Helpers.bind("user", html, "name" -> User.currentUser.map(_.lastName).open_!)
else
NodeSeq.Empty
}
Es sollte aktuellen Benutzername injizieren, aber ich empfange Ausnahme:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.scala_tools.maven.executions.MainHelper.runMain(MainHelper.java:105)
at org.scala_tools.maven.executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Caused by: scala.tools.nsc.symtab.Types$TypeError: type mismatch;
found : x$1.lastName.type (with underlying type object x$1.lastName)
required: com.liftworkshop.model.User#lastName.type
at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:352)
Was ist hier los?
Wurde die Scala von Maven installiert ist, oder verwenden Sie eine bestimmte Version davon? Auch, welche JDK-Version? –