I am porting a legacy system from rails into lift. It has a lot of hard-coded concatenated javascript that I would like to render into html pages.
According to this conversation here, we can use net.liftweb.http.js.JsCmds.Script object this way:
Script("""
var x = "Here's my JavaScript & it looks good";
""")
However, I got this compiler message:
error: type mismatch;
[INFO] found : java.lang.String
[INFO] required: net.liftweb.http.js.JsCmd
What is the correct way to use net.liftweb.http.js.JsCmds.Script?
Well, the conversation is clearly wrong.
The
applymethod fornet.liftweb.http.js.JsCmds.Scripttakes a JsCmd as a parameter – that’s the source of your compiler error.Now for that specific case, you could fix it to something like this:
(Str is
net.liftweb.http.js.JE.Str)