gpt4 book ai didi

playframework-2.0 - 使用 playframework 提交表单

转载 作者:行者123 更新时间:2023-12-01 09:05:29 25 4
gpt4 key购买 nike

早上好,我有一个表格,我也想用两个按钮提交它他们提交并将我重定向到另一个页面,我该怎么做带游戏框架??谢谢

最佳答案

在你的模板中做

#{form @nameOfTheController.nameOfTheAction()}


... some stuff

<input type='submit' name='action1' value="Submit button 1" />
<input type='submit' name='action2' value="Submit button 2" />
#{/form}

并在您的 Controller 中执行操作

public static void nameOfTheAction(String action1, String action2)
{
if(action1 != null)
{
// do logic that should happen when button 1 is pressed
}
else if (action2 != null)
{
// do logic that should happen when button 2 is pressed
}

}

关于playframework-2.0 - 使用 playframework 提交表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8614951/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com