如何在play框架中使用scala表单中的POST方法?
我正在尝试提交一个表单,它将重定向到另一个HTML页面。但这种行动方法不起作用 view.html如何在play框架中使用scala表单中的POST方法?,scala,playframework,Scala,Playframework,我正在尝试提交一个表单,它将重定向到另一个HTML页面。但这种行动方法不起作用 view.html @(bookForm:Form[Book])(implicit messages: Messages) <html> <head> <title>Create Books</title> <body> <h1>Create Books</h1> @helper.form(action=routes.Book
@(bookForm:Form[Book])(implicit messages: Messages)
<html>
<head>
<title>Create Books</title>
<body>
<h1>Create Books</h1>
@helper.form(action=routes.BooksController.save()){
@helper.inputText(bookForm("id"))
@helper.inputText(bookForm("title"))
@helper.inputText(bookForm("price"))
@helper.inputText(bookForm("author"))
}
<input type="submit" value="Create Book" />
</body>
</head>
</html>
定义的路由是
GET /books controllers.BooksController.index()
GET /books/create controllers.BooksController.create()
POST /books/create controllers.BooksController.save()
提交按钮应位于表单标签内:
@helper.form(action=routes.BooksController.save()){
@helper.inputText(bookForm("id"))
@helper.inputText(bookForm("title"))
@helper.inputText(bookForm("price"))
@helper.inputText(bookForm("author"))
<input type="submit" value="Create Book" />
}
这意味着什么:它不起作用?你有什么错误吗?如果是,请提供错误日志。
@helper.form(action=routes.BooksController.save()){
@helper.inputText(bookForm("id"))
@helper.inputText(bookForm("title"))
@helper.inputText(bookForm("price"))
@helper.inputText(bookForm("author"))
<input type="submit" value="Create Book" />
}