The moose likes HTML and JavaScript and the fly likes retrofitting AJAX into Struts application The Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » HTML and JavaScript
Reply Bookmark "retrofitting AJAX into Struts application" Watch "retrofitting AJAX into Struts application" New topic
Author

retrofitting AJAX into Struts application

L Bachdot
Greenhorn

Joined: Sep 06, 2005
Posts: 2
Can you tell me what would be involved in retrofitting AJAX logic into a Struts application?

If you use AJAX, is there still an advantage to making a new application into a Struts one?

Thanks,
LauraB
Barend Garvelink
Ranch Hand

Joined: Dec 07, 2004
Posts: 64
Can you tell me what would be involved in retrofitting AJAX logic into a Struts application?

If you use AJAX, is there still an advantage to making a new application into a Struts one?


Struts and AJAX are different technologies to solve different problems. One does not replace the other. AJAX is a client-side "add on" (so to speak) that you can use to improve the user interface. Struts is the good old server-side MVC framework that you're already familiar with.

The two can co-exist (in fact, the combination works very well together!). You can improve the user-interface of a struts application by using AJAX technology.

SCJP 1.4, SCJD 1.4, SCWCD 1.3, ICSD:Websphere 5.1
Bear Bibeault
Author and opinionated walrus
Sheriff

Joined: Jan 10, 2002
Posts: 39631
"Laura B.",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
L Bachdot
Greenhorn

Joined: Sep 06, 2005
Posts: 2
Thanks, Sheriff!

I have altered my profile to reflect my name, per your rules.

L Bachdot
Ryan Asleson
Author
Ranch Hand

Joined: Sep 15, 2005
Posts: 39
As I recently posted to a similar thread:


Hello,

Struts actually works very well with Ajax techniques, as long as you play by Struts' rules.

Struts will automatically populate an ActionForm from the query appended to an Ajax request. For example, if the URL of your Ajax request is ajaxRequest.do, you can append a query string like this:

ajaxRequest.do?parm1=hello&parm2=goodbye

If you have an ActionForm with properties parm1 and parm2, they will be automatically populated with the values hello and goodbye, respectively. The Action can then process the request normally and then return a response.

The Taconite framework (taconite.sf.net) integrates very well with Struts because it will automatically build the query string for you.

Ryan Asleson<br />Co-Author, <a href="http://www.amazon.com/Foundations-Ajax-Foundation-Ryan-Asleson/dp/1590595823/sr=1-1/qid=1158926537/ref=pd_bbs_1/002-7412154-2924860?ie=UTF8&s=books" target="_blank" rel="nofollow">Foundations of Ajax</a> and <a href="http://www.amazon.com/Pro-Ajax-Java-Frameworks/dp/1590596773/ref=sr_11_1/002-7412154-2924860?ie=UTF8" target="_blank" rel="nofollow">Pro Ajax and Java Frameworks</a><br /><a href="http://taconite.sf.net" target="_blank" rel="nofollow">Taconite</a> Lead Developer
 
jQuery in Action, 2nd edition
 
subject: retrofitting AJAX into Struts application
 
YouTrack 2.0