今天是个好日子,
我是Play框架的新手,我正在尝试开始构建应用程序.在app/controllers我创建子包的文件夹下,所以我有类似的东西app/controllers/products/ProductController.class.
在我的routes.conf文件中,我添加了这样的示例路线
GET /createproduct controllers.products.ProductController.listAllProducts()
POST /createproduct controllers.products.ProductController.createProductDetail()
我可以转到网址http://localhost:9000/createproduct并查看我创建的示例视图.
我现在的问题是我想在视图中添加一个表单,当我尝试使用表单助手方法从我的新视图中将数据POST到上面的POST URL时
@helper.form(action = routes.products.ProductController.createProductDetail()) {
我得到了错误
value products is not a member of object controllers.routes
我在网上看到的所有样本只使用route.Application示例,这不适合我的问题.
所以我的问题是我如何使用Form帮助器从一个视图反向路由到此操作或路由