English 中文(简体)
我如何在第二个氮类中利用升温值?
原标题:How can I use a Lift onSubmit value in a second snippet class?
  • 时间:2012-01-13 19:12:27
  •  标签:
  • scala
  • lift

我如何在第二次幻灯片中使用价值?

比如,我以下列形式进入年龄:

  <div>
    <form class="lift:OnSubmit?form=post">
      Age: <input name="age" value="0"><br>
      <input type="submit" value="Submit">
    </form>
  </div>

Snippet:

object OnSubmit {
  def render = {

    var age = 0
​
    // process the form
    def process() {
        S.notice("Age: "+age)
        S.redirectTo("/")
      }
    }

    "name=age" #> SHtml.onSubmit(s => asInt(s).foreach(age = _)) &
    "type=submit" #> SHtml.onSubmitUnit(process)
  }
}

我怎么能利用另一个幻灯类中的年龄值?

谢谢!

Best regards, John

问题回答

你们只能对一个投入要素一劳永逸,因此,你要么必须说明请求书的价值,要么使用另一类,要么可能的话,如果其唯一逻辑,而并非完全相同的要素将功能分解成海峡,而只是与其他幻灯类。

I m not sure exactly what you re trying to do though?





相关问题
How to flatten a List of different types in Scala?

I have 4 elements:List[List[Object]] (Objects are different in each element) that I want to zip so that I can have a List[List[obj1],List[obj2],List[obj3],List[obj4]] I tried to zip them and I ...

To use or not to use Scala for new Java projects? [closed]

I m impressed with Twitter and investigating to use Scala for a new large scale web project with Hibernate and Wicket. What do you think about Scala, and should I use it instead of Java? EDIT: And, ...

Why does Scala create a ~/tmp directory when I run a script?

When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...

Include jar file in Scala interpreter

Is it possible to include a jar file run running the Scala interpreter? My code is working when I compile from scalac: scalac script.scala -classpath *.jar But I would like to be able to include a ...

Scala and tail recursion

There are various answers on Stack Overflow which explain the conditions under which tail recursion is possible in Scala. I understand the limitations and how and where I can take advantage of tail ...

热门标签