早上好,我有一个表格,我也想用两个按钮提交它,每个按钮都提交并将我重定向到另一个页面,我如何使用 play Framework 来做到这一点?谢谢
问问题
3265 次
1 回答
9
在你的模板中做
#{form @nameOfTheController.nameOfTheAction()}
... some stuff
<input type='submit' name='action1' value="Submit button 1" />
<input type='submit' name='action2' value="Submit button 2" />
#{/form}
并在您的控制器中执行操作
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
}
}
于 2011-12-30T15:56:12.340 回答