如何进行基于注释的RequestMapping

时间:2011-01-20 00:17:27

标签: java spring spring-mvc

我从像/test/new.ui这样的ajax调用spring控制器。如何在控制器方法中执行RequestMapping。

先谢谢。

此致 拉朱

1 个答案:

答案 0 :(得分:1)

@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
    }
}