To fetch the querystring parameters in Controller we usually use request().queryString()
Map<String, String> queryString = request().queryString();
If we have multiple query-string keys and want to use a POJO to use query-string instead of parsing everything in Controller we can use QueryStringBindable
If you have take a look in your project you will see just simple parameters as argument ( Path argument ) in your GET method controller, In order to use Java POJO as input for query string i implements QueryStringBindable<T> in my POJO
Here is my sample POJO and my controller method
Added a entry in routes,
GET /test controllers.PaginationParamsTest.test(testViewModel: viewmodel.PaginationParams)
When you configure this action in your routes file, an error will be printed in your console. No QueryString binder found for type
Its required to add the below line in build.sbt
routesImport += “viewmodel.PaginationParams”
or we can simply add routesImport += “viewmodel._” to include all the Classes in the package
Passionate Developer with 7 years of extensive experience working for Data center related products. Contributed and lead the efforts in Solutioning and engineering in Nimesa Technologies for developing Dataprotection and Copy data management product for Private and Public Clouds
This is my personal weblog, opinions expressed here represent my own and not those of my employer.
All content provided on this blog is for informational purposes only and i will not be liable for any errors, losses, or damages from the display or use of this information.