Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Struts with Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with Ajax" Watch "Struts with Ajax" New topic
Author

Struts with Ajax

Dave Ni
Greenhorn

Joined: Jan 11, 2010
Posts: 3
Hi all, long time reader, first time poster.

I am looking at porting a highly complex app from Struts 1.2 into Struts 2.1 and a few outside consultants are recommending that we use Struts 2.1 with DOJO (they specifically mentionned DOJO). However from what I can tell on the documentation site, Struts 2.1 has deprecated DOJO due to it being based on an old version and other issues.

Anyone care to fill me in on what the latest is with Struts 2.1 and Ajax/DOJO? I have been looking at sites all day trying to get up to date info but just when I find I have something, I notice its a little out of date. Has Struts decided on a replacement approach to implment Ajax or is it all still up in the air?

Any info greatly appreciated.

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There's a jQuery plugin in the sandbox, but I'm actually not sure of its current status. It *will* be the S2 Ajax/JavaScript solution of choice, but that doesn't mean it will have all the functionality of the Dojo plugin (particularly in regards to widgets).

That said: I personally almost always recommend *against* using a tag-based Ajax/JavaScript solution, as it takes JavaScript generation and functionality out of the hands of the developer. If you don't know JavaScript, that can be good--or bad, depending on how much customization you need to do. I almost *always* recommend using a standard version of whichever JavaScript library you choose (and newer versions of Dojo are a fine choice--but the version we're deprecating is 0.4.3, which is *quite* old and out-of-date).

So they might be recommending "normal" Dojo, which is a fine solution. I would recommend *against* using the Dojo plugin, unless you're certain it has all the functionality you're likely to need. Even then, I'd be wary, just because it's so old, and again, eliminates the ability to hand-craft your JavaScript. This assumes a fairly high JavaScript skillset, which most Java developers do *not* possess.

If you have any specific questions, feel free to follow up.
Dave Ni
Greenhorn

Joined: Jan 11, 2010
Posts: 3
David, thank you for the reponse, I agree with everything your have said.

The old app being ported has some jQuery & Ajax, of which I am a bit fan off. I agree with your point on code generation, I am a big believer in code seperation (have the tags render the content and then get jQuery to handle the UI features) as we have already been burnt by other Ajax code generating tags (JSF). My app is very high volume so anything that takes the load off the server is a big win. I am also pushing for JavaScript unit testing which would be harder (if not impossible) with generated code.

The fact that jQuery is the future direction for S2 is pretty much what I needed to hear.

Thanks

Dave
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
If you want to use jQuery together with Struts2 then you can
try out the Struts2 jQuery Plugin, but it is not a part of the
main distribution.

Project: http://code.google.com/p/struts2-jquery
Showcase: http://www.weinfreund.de/struts2-jquery-showcase/


Bye

Johannes


My Java and Webprogramming Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts with Ajax