表单提交与playframework
早上好,我有一个表单,我也想用两个按钮提交它们,每个人都提交并将我重定向到另一个页面,我怎样才能使用框架? 谢谢
在你的模板中做
#{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
}
}
链接地址: http://www.djcxy.com/p/95129.html