I’m new in play framework and I’m trying to do a simple post to server.
In my routes I set:
POST /Hello/add controllers.Hello.add(name)
In my Hello.java class I set:
public class Hello extends Controller {
public static Result add(String name){
//add code
}
}
And in my html file:
<form action="Hello/add" method="post">
<input type="text" name="name" />
<input type="submit" value="Add" />
</form>
But when I click on the button ‘Add’, is lauched the following exception:
For request 'POST /Hello/add' [Missing parameter: name]
Someone knows why?
You have to use a DynamicForm in your Action, and to do not specify any parameter in the route file:
The route:
The controller and action: