我在Playframework中的URL生成方面遇到了一个奇怪的问题。
以下是模板中的代码段:
@ {Rooms.list(customerId?:customerId,location?:location,roomId?:roomId)}
很明显,我想生成一个这样的URL:
?/房间/列表客户= 1&安培;位置= ASDF&安培; roomId = 1
但最后我得到了这个:
/rooms/list?customer=1&location=asdf&roomId=1
我追溯了播放源代码并在“GroovyTemplate”中找到了它:
if (template.template.name.endsWith(".html") || template.template.name.endsWith(".xml")) {
def.url = def.url.replace("&", "&");
}
有人能说出这次替换的目的是什么?如何正确获取我的网址?
由于
答案 0 :(得分:2)
不确定这是否可以回答您的问题,但您可以尝试以下方法:
@{Rooms.list().add("customerId", customerId).add("location", location).add("roomId", roomId)}