【发布时间】:2014-01-05 12:50:21
【问题描述】:
我无法更改 ploeg 的值 punten。我做了一个按钮,它触发了一个可以改变点但没有任何反应的功能。这是我的按钮:
@form(routes.Application.geefPunten(ploeg.id)) {
<input type="submit" value="Gewonnen">
}
这是它在我的 Aaplication.java 中调用的函数:
public static Result geefPunten(Long id) {
Ploeg.geefPunt(id);
return redirect(routes.Application.ploegen());
}
然后这是我的 Ploeg.java 中的函数,它应该改变 punten 的值:
public static void geefPunt(Long id) {
Ploeg ploegje = find.byId(id);
ploegje.punten = ploegje.punten + 3;
}
这是我认为出错的路线文件:
# Home page
GET / controllers.Application.index()
# Ploegen
GET /ploegen controllers.Application.ploegen()
# POST /ploeg/:id controllers.Ploeg.zoekPloeg(id: Long)
POST /ploegen/:id/punten controllers.Application.geefPunten(id: Long)
POST /ploegen/:id/delete controllers.Application.deletePloeg(id: Long)
POST /ploegen/maak controllers.Application.maakPloeg()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
我个人认为路线有问题,但我找不到问题。已经找了好几天了。
【问题讨论】:
标签: java html playframework routes