PlayFramework 2.0.2路由中的多个参数

Ant*_*ick 3 playframework playframework-2.0

我似乎无法获得多个参数,如果我添加一个参数一切都很好,只要我添加第二个参数我总是得到一个

No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
Run Code Online (Sandbox Code Playgroud)

任何人都可以确认您可以使用play 2.0.2为请求添加第二个参数吗?(使用java)

我的网址就像这样简单

http://localhost:9000/account/foruser?username=somethig&create=0
Run Code Online (Sandbox Code Playgroud)

和路线

GET     /account/foruser
controllers.user.UserController.foruser(username:String, create:Boolean ) 
Run Code Online (Sandbox Code Playgroud)

bie*_*ior 13

你应该更多地关注路线文档和样本

通常,如果您使用命名参数,&name=value则不需要在路径文件中指定它们.而是在Java中使用DynamicForm来访问它们.

路径文件用于匹配unnamed链接的部分与控制器的动作和参数.所以你的链接应该是这样的:

http://localhost:9000/account/foruser/something/0
Run Code Online (Sandbox Code Playgroud)

和路线(当然这需要放在路线文件中的一行:

GET     /account/foruser/:username/:create
   controllers.user.UserController.foruser(username: String, create: Integer ) 
Run Code Online (Sandbox Code Playgroud)

请注意,这是在路由中使用布尔类型的一些错误报告,因此使用某些数字类型更安全.