[英]lift net.liftweb.http.S#param doesnt works like wiki says
i try to copying the examples in wiki http://wiki.liftweb.net/index.php/Hello_Darwin 我尝试复制Wiki http://wiki.liftweb.net/index.php/Hello_Darwin中的示例
in the example of HelloForm2.scala 在HelloForm2.scala的示例中
"submit" -> submit(?("Send"), () => {println("value:" + who + " :: " + param("whoField"))}),
It always prints 它总是打印
value:Full(hogehoge) :: Empty" even if i set the who as "object who extends RequestVar(Full("world"))
am i do something wrong? 我做错什么了吗?
sorry for forgetting to post full code, i already try the second one in the wiki like below. 很抱歉忘记发布完整的代码,我已经在下面的Wiki中尝试了第二个代码。 index.html
index.html
<lift:surround with="default" at="content">
<h2>Welcome to your project!</h2>
<lift:HelloWorld.show form="POST">
Hello <hello:who />
<br />
<label for="whoField">Who :</label>
<hello:whoField />
<hello:submit />
</lift:HelloWorld.show>
</lift:surround>
and HelloWorld.scala 和HelloWorld.scala
class HelloWorld {
object who extends RequestVar(Full("world"));
def show(xhtml: NodeSeq): NodeSeq ={
bind("hello", xhtml,
"whoField" -> text(who.openOr(""), v => who(Full(v))) % ("size" -> "10") % ("id" -> "whoField"),
"submit" -> submit(?("Send"), () => {println("value:" + who.openOr("") + " :: " + param("whoField"))}),
"who" -> who.openOr("")
)
}
}
now, the who shows correct in the rendered page, but console still prints value:hogehoge :: Empty
现在,谁在呈现的页面中显示正确,但是控制台仍会打印
value:hogehoge :: Empty
im using lift 1.0 即时通讯使用电梯1.0
thanks. 谢谢。
You have to change that code too, as shown in the example in the wiki page, which I'll copy here: 您也必须更改该代码,如Wiki页面中的示例所示,我将在此处复制该代码:
bind("hello", xhtml,
"whoField" -> text(who.openOr(""), v => who(Full(v))) % ("size" -> "10") % ("id" -> "whoField"),
"submit" -> submit(?("Send"), () => {println("value:" + who.openOr("") + " :: " + param("whoField"))}),
"who" -> who.openOr("")
)
Note that whoField is defined very differently. 请注意,whoField的定义非常不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.