Struts has been one of the major Java Frameworks for building Web applications for a number of years. Ajax is the latest buzz on building dynamic, user friendly web interfaces. How can Java Developers add the power of Ajax to these existing Struts Applications without having to tear out the existing code?
Sprinkle Some AJAX Magic in Your Struts Web Application, hosted on java.net, shows how.
How many ServerSide readers are actually developing using Ajax? Do they feel that it is living up to the hype? Are readers inclined to extend their existing (Struts based) apps, or go for a complete rebuild using something like DWR (Direct Web Remoting), Dojo, or other such frameworks?
-
Java.net Article on Using Ajax with Struts (13 messages)
- Posted by: paul browne
- Posted on: October 30 2005 09:06 EST
Threaded Messages (13)
- Java.net Article on Using Ajax with Struts by Vitaly Shevchuc on October 31 2005 07:45 EST
- Java.net Article on Using Ajax with Struts by Marina Prikaschikova on October 31 2005 09:32 EST
- Java.net Article on Using Ajax with Struts by paul browne on November 01 2005 04:21 EST
- Another option for the article by Elan H on October 31 2005 13:26 EST
- Another option for the article by paul browne on November 01 2005 04:23 EST
- AJAX returnnig HTML snippets by Brian Sayatovic on November 03 2005 07:35 EST
- Ajax In Portlets by vikramark singh on November 04 2005 10:22 EST
- Silly question by M L on October 31 2005 17:54 EST
- Silly question by paul browne on November 01 2005 04:17 EST
-
Silly question by Marina Prikaschikova on November 01 2005 08:46 EST
- Silly question by paul browne on November 01 2005 03:48 EST
-
Silly question by Marina Prikaschikova on November 01 2005 08:46 EST
- Silly question by paul browne on November 01 2005 04:17 EST
- The AJAX hypo is far reached by P s on November 14 2005 04:16 EST
- DWR and Struts? by Eric Ma on December 31 2005 10:51 EST
-
Java.net Article on Using Ajax with Struts[ Go to top ]
- Posted by: Vitaly Shevchuc
- Posted on: October 31 2005 07:45 EST
- in response to paul browne
The idea is good, but not too fresh ;)
AjaxAnywhere, AjaxTags and probably other open source projects already do the same thing without JavaScript coding.
http://ajaxanywhere.sourceforge.net/
http://ajaxtags.sourceforge.net/usage.html#ajax:htmlContent
Al least these two links should be present in your article to liberate your readers from unnecessary JavaScript coding. -
Java.net Article on Using Ajax with Struts[ Go to top ]
- Posted by: Marina Prikaschikova
- Posted on: October 31 2005 09:32 EST
- in response to Vitaly Shevchuc
Check out this also from Coldtags suite:
http://www.servletsuite.com/servlets/ajaxdivtag.htm
http://www.servletsuite.com/jsp.htm#ajax -
Java.net Article on Using Ajax with Struts[ Go to top ]
- Posted by: paul browne
- Posted on: November 01 2005 04:21 EST
- in response to Vitaly Shevchuc
Thanks for suggesting AjaxAnywhere.
In my opinion, one of the many Ajax Libraries that have sprung up will win out and become a de-facto standard, similar to what Struts was for the previous generation of Web Applications.
The focus of the article was adding Ajax to existing applications , without having to add or replace libraries. Where you have choice of moving to new libraries, the projects like AjaxAnywyere and AjaxTags are worth taking a look at - several others , including DWR are mentioned in the article.
Paul
FirstPartners.Net -
Another option for the article[ Go to top ]
- Posted by: Elan H
- Posted on: October 31 2005 13:26 EST
- in response to paul browne
I just started playing around with AJAX to do something similar to the example in the article. The solution I choose was not mentioned in the article and it was to have the AJAX call return the HTML for the table. That way I don't need to have any messy Javacript code to parse the response. And I reuse the same JSP logic that created the table initially. For my needs at least this approach appears to work well and I don't have the need for the other frameworks as of yet.
btw, I was designing a treeview widget where a tree folder could be lazy-loaded. -
Another option for the article[ Go to top ]
- Posted by: paul browne
- Posted on: November 01 2005 04:23 EST
- in response to Elan H
Looked at doing it that way - the difference between the two approaches is that the article can use an asynchronous call, so is more robust where there the network is not guaranteed (ie most internet and many intranets).
Paul
FirstPartners.Net -
AJAX returnnig HTML snippets[ Go to top ]
- Posted by: Brian Sayatovic
- Posted on: November 03 2005 07:35 EST
- in response to Elan H
I did a prototype like this. The AJAX call his the same Struts actions forwarding to JSPs and JSP fragments, returning the generated HTML to the XmlHttpRequest object. The client then just had to do element.innerHTML = req.responseText;
This had the advantage that I didn't have to write rendering code once in JSP and dynamic rendering code of the same markup in JavaScript. I just write it once and use it both ways.
However, we're now using a portal, and calling a portlet is different from calling an AJAX servlet, so reusing the same code just won't work without a lot of kludging. -
Ajax In Portlets[ Go to top ]
- Posted by: vikramark singh
- Posted on: November 04 2005 10:22 EST
- in response to Brian Sayatovic
One can also go through the following article:
http://portlets-jsr168.blogspot.com/2005/11/ajax-in-portlets.html
Regards,
Vikramark.
http://portlets-jsr168.blogspot.com/ -
Silly question[ Go to top ]
- Posted by: M L
- Posted on: October 31 2005 17:54 EST
- in response to paul browne
In the tutorial, After posting to the struts action, the struts action forwards to index.jsp [ view ]
I was under the impression, the action should refresh only a part of the page using Ajax. In this the view itself is bit different. -
Silly question[ Go to top ]
- Posted by: paul browne
- Posted on: November 01 2005 04:17 EST
- in response to M L
It's a good question.
To keep things simple , the action forwards to the same Index.jsp to display the page. The Page , using logic tags , decides which sections needs displayed.
It would be possible to forward to a different page as long as the <Span> tags are the same on both pages. The article mentions this (near the end), but does not go into detail.
FirstPartners.Net -
Silly question[ Go to top ]
- Posted by: Marina Prikaschikova
- Posted on: November 01 2005 08:46 EST
- in response to paul browne
What is a POST back pattern right from ASP.NET
Do we really need a Struts?
Marina
http://www.servletsuite.com -
Silly question[ Go to top ]
- Posted by: paul browne
- Posted on: November 01 2005 15:48 EST
- in response to Marina Prikaschikova
Many people have been asking the question 'do we need Struts' for quite a long time , even though it has served the Java Community Well :-)
Struts is a Java - Web implementation of the Model-View-Controller pattern. I wouldn't be surprised if it was close to an ASP.Net pattern, given the amount of cross-pollination between the two.
Paul
FirstPartners.net -
The AJAX hypo is far reached[ Go to top ]
- Posted by: P s
- Posted on: November 14 2005 04:16 EST
- in response to paul browne
Please read
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp
http://codeproject.com/useritems/LeakPatterns.asp
One has really to think about using JavaScript for non-trivial stuff. -
DWR and Struts?[ Go to top ]
- Posted by: Eric Ma
- Posted on: December 31 2005 10:51 EST
- in response to paul browne
Has anyone used DWR to call Struts Action classes (or a thin wrapper on top of it)? We have a lot of existing Struts code and we would like to leverage it.