【发布时间】:2013-03-18 04:07:33
【问题描述】:
我有两个 html 页面:/algorithrms 和 /algorithms/add 用 scala 模板编写。路由文件包含以下几行:
GET /algorithms controllers.Application.algorithms()
GET /algorithms/add controllers.Application.newAlgorithmForm()
我想在页面/algorithms 中添加一个按钮,当我单击该按钮时,它只是重定向到第二个页面/algorithms/add。我知道如何在 JavaScript 中做到这一点。我只想通过单击按钮调用一个动作,然后让该动作将我重定向到登录页面。
所以我在第一页的html模板中添加了如下代码:
@form(action=routes.Application.newAlgorithmForm()){
<input type="submit" value="Add">
}
成功了,但是登陆网址是:http://localhost:9000/algorithms/add?
我不想要那个问号。我想知道 1)我做错了什么导致问号生成以及 2)如何删除它?
【问题讨论】:
-
如果您最终将使用表单发送信息(有一些其他表单字段),您可以将
add方法定义为POST而不是GET。否则你可以听从 adis 的建议。 -
@EECOLOR 不,我不会随表格发送信息。所以你是对的,我想要的是 adis 的解决方案。
标签: html scala playframework-2.0