开发者

Struts2 - Question about AJAX implementation

开发者 https://www.devze.com 2023-01-28 14:19 出处:网络
I new on Struts2, and i need to do some AJAX call to the server. I tried to search some tutorial, but expect roseindia ones, i don\'t find nothing.

I new on Struts2, and i need to do some AJAX call to the server.

I tried to search some tutorial, but expect roseindia ones, i don't find nothing. Also, i don't understand i开发者_运维知识库f Struts2 implements natively Ajax or if i must use it with some library (like Dojo or Jquery?).

Also, can you give to me some good tutorial?

Cheers


Struts2 is an MVC framework for building server-side web applications and Ajax is a concept that exists within the client-side of things. From the server's perspective, it just needs to respond to an HTTP request (which happens to come from JavaScript for Ajax).

Therefore, Struts2 does not "implement Ajax." You'll need to use JavaScript (or a JavaScript framework like jQuery, Dojo, etc.) as you mentioned.

You can use these in Struts2 just as you would in any web project, by including the necessary JavaScript and CSS files, or you can use a Struts2 plugin (there are plugins for both previously mentioned libraries).

I'm pretty sure that the jQuery and Dojo plugins contain tag libraries for doing Ajax.


we use the struts 2 json plugin for returning json from struts actions.

on the client side, you'll likely want to use a javascript framework like jQuery to issue your ajax calls and then handle the json response.

0

精彩评论

暂无评论...
验证码 换一张
取 消