I'm relatively new to Java EE and I'm in need of a framework that will simplify AJAX for me.
At the moment I have code that uses the dojo toolkit to draw a graph, but I'd like to have the graph updatable via AJAX. is there a good framework that allows me to do Ajax call backs and insert and run javascript into a page?
If so is there a good tutorial on how to use this framework?
My only experience with Ajax is using Telerik under ASP.Net.
Dojo does AJAX too.
Normally I'd recommend jQuery for this kind of thing but you're already using Dojo so you should probably use that. The two can be used together however, if desired.
There are some JSF component libraries that got more or less ajax support. ICEfaces for example, makes all the standard components ajax'ish and offers server push techniques. Check out the jsfmatrix to get an overview.
Related
I am planning to write a medium scale web application. The server side technologies will include Java, Hibernate, MySQL and the client technologies will include Html, CSS, Javascript and Jquery.
I am looking for the best suitable Java framework for developing web (Struts, Spring, Wicket and so on).
I consider myself heavy Jquery user and I really prefer to do client side stuff.
Wicket for example has modules like the date picker and other modules (AJAX) that should make life easIer with javascript and acts like a replacement to it. But I really prefer javascript.
I thought of writing an application with client side and Java Web Services.
What do you think?
Do you know a framework that isn't afraid of Javascript or don't
suggest replacement to it but tools to use it?
Component-based frameworks generally provide ready-to-use components, that come with their own JavaScript code. If you don't like this, I would stick with action-based MVC frameworks, which generally don't care about what you use at client-side.
My preferences go to Stripes and Spring MVC, but YMMV.
I'd recommend the Play! Framework.
It is a MVC based framework and you can use hibernate, work with a MySQL database and it offers templating for easy HTML generation as well as working well with CSS and Javascript (even includes latest JQuery in download). There are also tons of modules you can add to your project to make development faster and easier.
Play 2.0 should be released fairly soon (currently available in beta) which provides support for CoffeeScript and Less CSS (see here) amongst many other new features.
Edit
StackOverflow answer showing how easy it is to create webservices in Play: https://stackoverflow.com/a/4513047/681807
Well all the framework you have mentioned (struts, spring, wicket) , none of them afraid of javascript.
Like in Struts2 and Spring they have provided build in ajax support for developer like me who is more comfortable with serverside development than client side work (ajax/jquery fancy stuff).
Its on individual how he/she is using JS with any existing framework and you are even free to use simple HTML at you client side with whatever JS way you want to apply to your UI.
Framework support to UI is always intended to provide a close integration to the server-side so as to speedup the overall development time.
In Short i can not recommend any framework as that will dependent upon you project requirements which fits perfectly as per your need, but none of the framework will stop you to use JS in the way you want to use.
I'm just getting involved with Servlets, Tomcat, JSP etc and was wondering what people typically use for GUI's in their JSP pages (for client-side interactivity). I've used jQuery, YUI, extJS, etc. for JS scripting in simple webpages, but what about for web applications? Do these client-side technologies integrate well with JSP pages? Are there tag libraries out there to help with this sort of thing?
Any suggestions?
As a specific example, would it be a good idea to populate a YUI DataTable using JSP embedded in the JavaScript?
For rich GUI, consider looking at JSF. There are lot of JSF component libraries around which offers GUI awesomeness, for example PrimeFaces. It's basically using jQuery / jQuery UI under the covers. Checkout for example the Mock OS X demo.
If you don't want to bow for a component based MVC framework like JSF, then you can also just go ahead with "plain" jQuery / jQuery UI. It shouldn't be that hard on JSP. All JSP basically does is generating and sending some bunch of HTML/CSS/JS code from webserver to webbrowser. All JavaScript/jQuery basically does is intercepting on the HTML DOM tree as the webbrowser has retrieved (in other words, it has totally no knowledge about the server side JSP code which generated/sent it).
You only need to realize that afterwards bringing a component based MVC framework in an existing JSP/jQuery webapplication isn't that easy. Rather look for a request based MVC framework like Spring MVC then.
Related questions
What is the need of JSF when rich UI can be achieved by plain HTML/CSS/jQuery?
You can use any of those libraries. I personally prefer jQuery. I've also used prototype and Ext JS in the past. Some frameworks integrate proprietary or generic Ajax approaches, but I find the popular ones (such as those you listed) to be a better alternative.
In my opinion WWW will sooner or later come to full-blown AJAX web-sites, so that we wouldn't have
page reloads every time you click somewhere.
Now I want you to ask this.
What tools and frameworks can one use to make a Java Web-application running on Tomcat
have AJAX functionality like "in-place, with no page reloading" table sorting by
clicking on its column header, multi-tabs that enable opening at once the new screen to the user without reloading a page, saving data in the database without reloading a page, and other similar things that we do not usually see on web pages.
That's all should probably be based on AJAX.
But how to integrate this AJAX functionality with existing java web-frameworks, let's say Spring MVC?
Or maybe there are other frameworks that better suit such needs but that can be integrated with core Spring?
Your question is rather confusing--AJAX calls are all client-side, any server-side technology can return data to the client.
That being said, you may try taking a look at Google Web Toolkit.
With the GWT SDK, you write your AJAX front-end in the Java programming language which GWT then cross-compiles into optimized JavaScript that automatically works across all major browsers. During development, you can iterate quickly in the same "edit - refresh - view" cycle you're accustomed to with JavaScript, with the added benefit of being able to debug and step through your Java code line by line. When you're ready to deploy, the GWT compiler compiles your Java source code into optimized, standalone JavaScript files.
Among other things, GWT supports built-in serialization of objects for transfer to your Java servlets, allowing for crazy-easy (the technical term) integration of your GWT client and existing Java technologies.
Homebrewed/3rd-party Ajax stuff with JSF isn't that easy since you have to take its lifecycle and component tree into account. You would need to write your own ViewHandler. Rather look for what's already available. To start, JSF2 already provides builtin Ajax functionality with under each <f:ajax>. There are further also a lot of Ajaxical JSF component libraries, like RichFaces (showcase here).
No wording about Spring as I don't do it.
I'm looking for a java AJAX framework which I can include into my existing webapp. I've found sweetDev RIA . Are there such other frameworks which I could look into it?
I'd take a look at DWR: Direct Web Remoting. It allows you to directly call Java (web services) from JavaScript in a really intuitive way.
Last couple of years, I have been developing rich looking web applications with icefaces. It is pretty cool, ajax is buit-in and it blends very well with jsf. If you use icefaces, javascript is not required anymore. In our web project we use javascript only in couple of places.
Here is an excerpt from icefaces homepage: "As a leading open source Ajax framework, ICEfaces is more than a Ajax JSF component library, it's an J2EE Ajax framework for developing and deploying rich enterprise applications (REAs). With ICEfaces, enterprise Java developers can easily develop rich enterprise applications in Java, not JavaScript."
I suggest ExtJS (with jQuery underneath), but you might prefer GWT. I think it's easier for Java programmers who are seeking to wade slowly into JavaScript waters.
I would really check out extjs.com. It is the most feature complete javascript component library I know of. The components are fast, have beautiful default styling, and the API is very powerful. AJAX support is also excellent. Most of my current web development include extjs in some way.
It's very easy to use this library with java. Most of the time, I just have some server side component that returns data in JSON.
There is also ExtTLD; a tablib wrapper for extjs. I have never used it myself, though.
Google Web Toolkit ( GWT )
you can also use Apache's 'Myfaces' project http://myfaces.apache.org
Its a JSF implementation, and also has components with in built ajax capability.
You can try SweetDevRia, it's possible to add ajax in your application without writing Javascript. You only need to use JSP tags
I was wondering if I could pop up JOptionPanes or other Swing components from within a browser using JSP.
If you embed an applet. But I don't think that's what you want. Swing is for desktop apps. JSP web pages. If you want components, try looking into JSF or some of the many AJAX Javascript frameworks like prototype.
You may also want to consider GWT, which enables you to develop a web interface in Java code (the Java code is converted to HTML & JavaScript by the GWT compiler). Although you don't program to the Swing API directly when writing GWT applications, the GWT API is very similar in style to Swing programming.
Assuming you're familiar with Swing, you may want to introduce yourself to Apache Wicket which is very similar to the way you build web pages as Swing is to building GUI:s. That is, in Wicket you add new instancef of Label, Button, DataTable etc. etc. to page and link those to bean property data which is then ultimately transformed to fully functioning web page.
As for the actual question, you really can't do it as-is. If choosing a new/different/another web framework to help you isn't possible, the only proper way I can think of is doing what sblundy suggested.