报错代码信息:
将 "howdy" 方法改为以下内容:
打开 http://localhost:8080/,控制台报错输出:
>FOO
>WARN - Snippet Failure: SnippetFailure(/ -> ParsePath(List(index),,true,false),Full(helloWorld.howdy),Method Not Found)
[quote]
either the method should not be invoked because the signature is wrong (therefore not emitting "FOO"), or the error message to be changed to say that the method was found, but the signature is incorrect.[/quote]
以上引用是外文网站上的说明,说的应该是方法签名出错,不应该存在大括弧。
而且下面两段代码第一段运行会报错,第二段是正确的:
第二段的"="与<div>之间有个空格,如果没有这个空格就会报错。
另外,以下代码作为代码片断嵌入页面时:
最终的代码:
调用代码:
Snippit with incorrect signature gets invoked, but erroneously produces "Method Not Found"
将 "howdy" 方法改为以下内容:
def howdy = {
System.out.println("FOO")
0
}; // <span>Welcome to hyperview at {new root.java.util.Date()}</span>
打开 http://localhost:8080/,控制台报错输出:
>FOO
>WARN - Snippet Failure: SnippetFailure(/ -> ParsePath(List(index),,true,false),Full(helloWorld.howdy),Method Not Found)
[quote]
either the method should not be invoked because the signature is wrong (therefore not emitting "FOO"), or the error message to be changed to say that the method was found, but the signature is incorrect.[/quote]
以上引用是外文网站上的说明,说的应该是方法签名出错,不应该存在大括弧。
而且下面两段代码第一段运行会报错,第二段是正确的:
def hello =<div>hello world</div>
def hello = <div>hello world</div>
第二段的"="与<div>之间有个空格,如果没有这个空格就会报错。
另外,以下代码作为代码片断嵌入页面时:
def render = {new java.util.Date}//不会有输出
def render = <span>{new java.util.Date}</span>//输出当前时间
最终的代码:
package x.y.snippet
import java.util.Date
class Util {
def in = <span>xxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy</span>
def out = <span>xxxxxxxxxxxxxx</span>
def demo = <span>demo demo demo</span>
def hello = <div>hello world</div>
def render = <span>{new java.util.Date}</span>
}
调用代码:
<lift:Util.in />
<lift:Util.out />
<lift:Util.demo />
<lift:util.hello />