Form Submit with playframework

Good Morning, I have a Form and i want too submit it with two buttons each one of them do the submit and redirect me to another page, How can i do that with play Framework ?? Thanks


in your template do

#{form @nameOfTheController.nameOfTheAction()}


... some stuff

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

and in your controller with the action

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/95130.html

上一篇: 将日志记录级别设置为在Playframework 2.0生产中进行调试?

下一篇: 表单提交与playframework