I am currently a asp.net guy, but have to do some jsp work now. I know that in asp.net, you can define a public static method with [WebMethod]
attribute e.g.
[WebMethod]
public static string GetIt(string code)
{
return GetSomething(code);
}
then, I can call this mehtod in 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.
}
});
can someone give me some light how to do it using jsp?