@Requestparam with a param and without

Yes, it’s possible.

Assuming you’r using Spring take this code as an example:

@RequestMapping(value="/getStudentOverallPerformance)
public String example(@RequestParam(required=false) long yid, etc...){
  /* your code */
}

In this case you can call this method with or without parameter “yid” that i declare as “long” but you will use type you declared.
I set:

(required=false)

because as default it’s true, and so you couldn’t access this method without have parameter.

Leave a Comment