java - Cannot handle request by requestMapping -
i need handle requests like
www.example.com/student/thisisname?age=23&country=uk&city=london
i interested in thisisname
part , value of city
parameter.
i have following requestmapping not work. tried {name}{.*:city}
well.
@requestmapping(value = "/{name:.*}{city}", method = requestmethod.get)
you can 2 ways. either using @requestparam or @pathvariable
- by using @requestparam
@requestmapping(value = "/name", method = requestmethod.get) public void somemethod(@requestparam string city){}
- by using @pathvariable
@requestmapping(value = "/name/{city}", method = requestmethod.get) public void somemethod(@pathvariable string city){}
you can use of method need concentrate on url
Comments
Post a Comment