【发布时间】:2010-10-21 08:14:05
【问题描述】:
我目前是一个asp.net 人,但现在必须做一些jsp 工作。我知道在 asp.net 中,您可以使用 [WebMethod] 属性定义一个公共静态方法,例如
[WebMethod]
public static string GetIt(string code)
{
return GetSomething(code);
}
那么,我可以在jquery中调用这个方法
$.ajax({
type: "POST",
url: "PageName.aspx/GetIt",
data: "{'code':'+$("#code").val()+"'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Do something interesting here.
}
});
有人可以告诉我如何使用jsp来做吗?
【问题讨论】:
-
JSP 是一个页面布局框架,而不是一个控制器框架。