AJAX with Struts 1.x Version - ajax

I am having an application developed with Struts1.3, Jboss4.X version and jdk1.5
Now as an enhancement we are planning to implement AJAX to the web application
Can you please suggest me
Whether I can use AJAX with Struts1.3 Framework?
Which Jar I need to use if I Can implement AJAX?
At Some website, I realised struts2-dojo-plugin.jar can be used for Struts2, whether the same jar works for Struts 1.3 Version
Please clarify my doubts

Yes. You can use AJAX with the struts1.3 framework. AJAX is mostly done in the JavaScript on the client. It requests a URL on your server which will correspond to an action that you write. As far as the browser is concerened it knows nothing about struts, it just happily request pages assuming they are all static html pages.
You do not need any special jar files to use AJAX. In struts2 they included dojo making it simple to use that library without needing extra libraries. However, you can download and install any javascript library such as jQuery, dojo, prototype etc that will help you do AJAX.
Most likely not. the struts2 Dojo integration will not work out of the box in struts1.3 You can use the Dojo library if you wish but you will have to do it yourself.
Some links:
AJAX and Struts1 and Struts2
Justin Coyne

Related

Do you need to use a framework to Ajaxify your java web app?

I am currently studying Java EE with Hibernate for a project. In The Web App I am creating I am planning to Ajaxify page contents, and Site wide audio player(Which I think would be implemented using AJAX).
I am using a JSP based MVC, no frameworks, Just Java EE and Hibernate. And I've heard that I need to use a Framework like JSF to be able to AJaxify may web-app. How true is this? Do I really need to learn JSF or other frameworks to be able to Ajaxify my web app? As much as possible I do not want to learn a new framework for now since it is a big learning curve. but if there's no other way to Ajaxify my web app, I'll study a framework.
You don't have to adopt any framework to use partial page updates and similar, you can construct and send requests "manually" with JavaScript, but this is much more tedious then using a framework like JSF, maybe coupled with a component library like primefaces.
EDIT: you can find an abundance of examples of ajax capabilities in the primefaces showcase. Primefaces uses JQuery internally.
EDIT2: I have found some resources on how to dispatch ajax requests with JQuery from a JSP page (I assumed that using JSP was almost equal to not using a framework ;)): here and here. I hope this is what you were looking for.
To add on #Kostja's answer -
I totally agree with him, with Ajax you just need to have a servlet to handle the HTTP requests, and proper JavaScript code.
Besides JSF,I would also consider to look at Apache Wicket - you can read here how Wicket handles Ajax.
The reason I'm suggesting Wicket is that it's more comfortable to some developers to work with somewhat more "component oriented" (swing-like) framework.

Spring MVC 3 and Ajax library advice

I'm developing a webapp with Hibernate+Spring 3 (Spring MVC, JSP): I'd like to create some divs with AJAX style (i.e. no need to refresh all the page, independent update of each div).
I'd like a good advice about which AJAX library to use (in conjunction with Spring 3 MVC + JSP) and, if possible, where to find some code snippets.
I know very little of AJAX libraries, JSONs and how to integrate them, but I have good knowledge of Javascript and Spring (and how callbacks work). I'd like to write as less code as possible, particularly in the jsps.
My Webapp will display an updated (every 5 minutes) POJO in a div and perform some operations between different domain objects in the other div when user press a button.
This is correct use JQuery
Here
http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/
you can find working examples to use Jquery+JSON+Spring MVC.
and this question can help you with server side configuration:
JQuery, Spring MVC #RequestBody and JSON - making it work together
I would suggest jQuery. It is very easy to use and has very good ajax support.
In addition to that it has quite a lot of plugins and components.

Struts2 - Question about AJAX implementation

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 if 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.

Using YUI with Spring framework

i am new to ajax technology
and i want to use YUI technology with spring framework
so please guide me where to start;useful links & tutorials
thank you.
YUI is a Javascript library. Spring is a Java application framework. These are not directly related; ie, Spring has no YUI hooks or anything like that.
Spring MVC and Spring Web Flow can be used to build web applications, and web applications can serve whatever files you want, including any Javascript files you have.
Here is a list of YUI examples.
YUI is a client side js library, and has little to do with serverside frameworks; so, Spring and YUI are not related.
if your are looking to work with YUI2, or for YUI3. also yui-gallery is a good place to get started with the examples.
YUI Theater has a whole bunch of developer videos to help you understand the internals of YUI JS Library, is a place worth spending time

Add Ajax Support to Spring MVC

I would like to add ajax to an existing spring mvc 2.5 webapps. But i dont know where to start.
I think spring does not support ajax integration.
Does someone know how can I accomplish this? I was thinking that my ajaxrequest should be catch by the controller interface but I dont know where to start.
I dont want to use any ajax library at this point but just plain old ajax approach
Kindly send me links or tutorials if what I am thinking is possible please
Spring MVC does not provide out of the box Ajax support. However it provides suitable extension points through its template based design to enable Ajax support very easily. Still you can implement it using jquery library.

Resources