简体   繁体   中英

What is analogue of @PathVariable in Jakarta EE?

How can I do the same in Jakarta EE?

@GetMapping("/page/{pageNo}")
public String findPaginated(@PathVariable("pageNo") int pageNo) {
    // stuff
}

I think what you try to ask is the equivalent JAX-RS annotation for spring-mvc 's @PathVariable ? It is @PathParam .

So given this spring-mvc configuration:

@GetMapping("/page/{pageNo}")
public String findPaginated(@PathVariable("pageNo") int pageNo) {
    
}

the equivalent JAX-RS version is:

@GET
@Path("/page/{pageNo}")
public String findPaginated(@PathParam("pageNo") int pageNo) {
    
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM