java - Returning Total No of Records in @RequestParam in spring -


     @requestmapping(value = "/states/{countrycode}", method =  requestmethod.get )     public service getstates(@pathvariable ("countrycode") string  countrycode,@requestparam(value = "count", required = false, defaultvalue =  "10") integer count) 

in case problem don't want set default value count,

if user pass count should return many number of records , returning ,but when user not passing count should return record db,but not working service return logic return modelststelist.sublist(0, count); here count coming method parameter in service.

in case, remove required = false, defaultvalue = "10"

add this,

public service getstates(@pathvariable ("countrycode") string  countrycode,@requestparam(value = "count") integer count) 

pass count backend, details , return it


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -