I need to call java class method inside jquery , how do i do that ?
For more understanding Ex:
Class Foo{
public static void letsCall(){
// Do something here ...
}
}
I want to call this letsCall() Method from jquery.
解决方案
1 approach:-
in jquery api, to call any backend system , in your case java, you need to do ajax call to invoke your java controller or service.
2nd approach:-
if you need java class to take part in your jsp formation , you can go for custom tags, in your case you can look for jsf framework which basically bind your user events to your controller.
other frameworks - springmvc bind your jsp attributes to its corresponding models, in this case no need to use jquery , you can achieve it through spring custom tags.
spring custom tags example