简体   繁体   中英

How to provide dynamic path to a file in Spring Controller

Is there any way to pass arguments in Spring Controller like we do in Standalone Java Application

    String filePath=args[0] 

Here is the code below I want to provide file Path

    @RequestMapping(value="/someUrl/", method=RequestMethod.GET)

    String imageFilePath=? //Is there any way to pass the arguments here

Use @PathVariable annotation.
In your jsp send your request by sending some variable like

action=/${someurl}/ 

In your controller you can then use it ex:

@RequestMapping(value="/{someurl}")
functionName (@PathVariable String yourUrl)

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