[英]set parameter in play framework action within template
I have a single input form in a play scala template: 我在play scala模板中有一个输入表单:
@helper.form(action=routes.Application.searchResult()) {
<input type="text" name="userQuery" value="@userQuery">
}
and would like to pass an extra parameter, '@channel' to the searchResult action, which it takes as an optional argument. 并希望将一个额外的参数'@channel'传递给searchResult操作,该参数作为可选参数。
@channel is passed as an argument to the current template. @channel作为参数传递给当前模板。 What's the simplest way to do this? 最简单的方法是什么?
I tried replacing 我尝试更换
routes.Application.searchResult()
with 与
routes.Application.searchResult(channel=channel)
with no success 没有成功
您可以更新到操作的路由以在那里传递参数,或者将表单映射与相应的参数解析器一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.