我正在从ajax调用spring Controller ,例如/test/new.ui
。如何在 Controller 方法中进行RequestMapping。
提前致谢。
问候, 拉朱
最佳答案
@Controller
@RequestMapping("/test/") //This is optional to separate the /test/ part from the new.ui if you want to do other urls under the /test/
public class SomeController {
@RequestMapping("new.ui") //You can also do the entire url fragment here "/test/new.ui"
public Object handleNewMethod(/* ModelAttributes, Errors, RequestParams here */) {
// Code here
}
}
关于java - 如何进行基于注解的RequestMapping,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4742246/