hengheng123456789

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  297 Posts :: 68 Stories :: 144 Comments :: 0 Trackbacks

A while back , I wrote an article for O’Reilly’s sister site , Java.net about How to add Ajax to your Struts Application. While it was pretty straightfoward (as is Ajax underneath all the hype), it still involved a little to much JavaScript for my liking. Nothing against JavaScript, but if you write it , you have to support it. Far better to use a standard Ajax library , like DWR , Prototype or Dojo.

So , along comes Struts 2. Be careful - it’s good , but a different beast under the covers from Struts 1. It does a lot of things better - for example , the way it has Actions as normal POJO’s makes it a lot of things easier to unit test.

Struts 2 also gives you Ajax ‘out of the box’. No writing of javascript, no debugging against various browsers; just configure and go. A full description of how to setup Struts 2 to use Ajax is in this wiki article. The quick version is:

1. Setup Struts 2
2. Add the Struts-Ajax URL and Div Tag.

That’s it. Ajax without the fuss.

Even better that the Struts guys have implemented the Ajax functionality using the Prototype Ajax Library, so you get the benefit of all the improvements there.

What do you think? Will you move to Struts 2 just for the new Ajax capabilities?

posted on 2007-09-03 17:41 哼哼 阅读(414) 评论(0)  编辑  收藏 所属分类: JAVA-Web

只有注册用户登录后才能发表评论。


网站导航: