Templates 在Play框架模板中使用查询字符串生成URL

Templates 在Play框架模板中使用查询字符串生成URL,templates,playframework,routes,Templates,Playframework,Routes,我使用的是play 1.1,我有一个URL映射路由文件 */show/{id}/TestController.show 而TestController被指定为 publicstaticvoidshow(stringid){} 当我通过@{TestController.show(id)}在HTML模板中使用上述路由时,我希望在浏览器地址栏中呈现为/show/23/,但像这样,它被呈现为路由文件中优先级最低的默认映射(/TestController/show?id=23)。您能帮助我如何将URL

我使用的是play 1.1,我有一个URL映射路由文件


*/show/{id}/TestController.show

而TestController被指定为

publicstaticvoidshow(stringid){}


当我通过
@{TestController.show(id)}
在HTML模板中使用上述路由时,我希望在浏览器地址栏中呈现为
/show/23/
,但像这样,它被呈现为路由文件中优先级最低的默认映射(
/TestController/show?id=23
)。您能帮助我如何将URL呈现为
http://localhost:9000/show/23/

操作参数必须与传入模板的类型相同,因此如果使用
@{TestController.show(id)}构建href-in模板
其中id是
Long
int
的porbly类型,使用相同的参数声明您的操作

public static void show(Long id){
  ... action's body ...
} 

你能写一个例子吗?你期望什么?很可能你在模板中使用的id不是字符串,而是长或int,而不是你应该使用的:public static void show(长id){…action's body…}好的,发布一个答案,请接受它让人们知道,这是正确的方式