Looking to implement a RIA using AJAX with Java on the backend.
I was looking at DWR for an RPC style approach, but the project hasn't been updated since 2008.
I was also looking at DOJO and GWT.
Can anyone recommend a core set of technologies that works best for a Java based back end, that contains a rich set of client side widgets and backend integration with Spring WebFlow/MVC?
thanks
I would recommend Spring 3.0. It's up to date, lightweight, easily configurable, supports dependency injection, annotated classes, and is a great framework.
It supports REST, so it's easy to implement classes that return JSON to your HTML pages. This will help keep your content, behavior, and presentation all separate while still enabling you to build a Rich Internet Application.
Although outside the scope of your question, I'd suggest you use JQuery on the frontend as I've had really good results using it to transfer JSON back and forth from the server.
I would stay away from DWR. They merged with Dojo, which in my opinion is a better choice than DWR. DWR sounded good, but in practice it was buggy and difficult to use. Dojo was much cleaner and more modular. But unless you're using Comet (aka Reverse Ajax) just stick with Spring and JQuery.
Spring 3.0 is also supported on Google App Engine... just worth mentioning as Platform as a Service is in our future.
My recommendation is a RIA framework like SmartClient or ExtJS + a REST-based backend (built on Jersey, for example). I have also found JQuery to be extremely helpful when combined with these frameworks. Together. this allows you to build your GUI right on top of a REST API, which itself could be reusable for programmatic integration.
These kinds of questions are always religious ones, but FWIW I am personally not a massive fan of GWT, for multiple reasons. One of those reasons is because I don't want server side folks constructing GUI-targeted data structures (I'd rather have them stick to pure data and let me GUI folks handle the GUI stuff). So I actually don't appreciate that capability of GWT, but obviously many other people welcome that aspect, so again it's a religious choice.
you can try GWT.That supports Spring well.
http://www.springbyexample.org/examples/simple-gwt-spring-webapp.html
If you use a Spring MVC back end, you can use any AJAX frontend there is.
And if you are going to develop a RIA, I would suggest either Prototype with Script.Aculo.Us (Killer GUI effect library) or MooTools (which is either an extension or a re-write of prototype, that also includes many GUI tools).
The great thing about both ProtoType and Mootools is their Object-Oriented methodology (MooTools Class() docs, Prototype Class.create() docs), but the extension mechanism that gives additional methods and properties to DOM elements (How Prototype extends the DOM, MooTools Element reference). Of course this mechanism is exactly what the JQuery guys loathe about these libraries. But the nice thing is that because of these extensions, you hardly ever have to resort to browser-specific programming, the abstraction handles that for you.
I choose JSF for RIA applications.
It is J2EE 6 standard
it built-in in J2EE application servers (glassfish, jboss),
it has several implementations - if you have problem with one, you can switch to another
I has at least 4 (richfaces, myfaces, icefaces, primefaces) independent, big components libraries.
Spring can work well, but my personal preference is for simplicity, and Spring is bit heavy platform. So I prefer deploying services on JAX-RS containers (like Jersey); Guice for wiring things together, and in case I want to override or change data bindings, Jackson for JSON handling.
Other useful pieces would be jDBI for database access (much simpler than hibernate or other full ORMs), async-httpclient for doing calls to other web services.
Best of all, these all work nicely for many other kinds of uses.
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 am in the process of beginning development of a web-based user interface and am looking for some expert advice on the right direction for my project.
Since our server-side is to be developed using Java, I am planning to use scriptless-JSP and an MVC framework called FrontMan. FrontMan is a lightweight Java-based MVC framework similar to Struts. I have played around with it and like it. The plan is to use scriptless-JSP assisted by JSTL and JSP tag files. I worked out some prototypes using these technologies and I liked what I had.
Now I am in the process of planning out the client-side stuff. My plan is to use JavaScript, jQuery, jQuery UI to build the front end. During my investigation I came across a very nifty JavaScript MVC framework named JavaScriptMVC. I have to say I really like it. It is not just a client-side MVC framework, but also includes tools for testing, documenting and deploying.
The more I engage in figuring out the client-side plan, I realize that I think this is going to be more of a JavaScript (client-side) app. I am leaning towards doing as much of the work in JavaScript rather than on the backend via Java. The backend will exist mostly for communicating with the database and responding to requests from the client (frontend) for manipulating or retrieving data.
I am rather new to RESTful web services, but in the little I have read about them, I think this might be a good direction to take this project.
I am wondering how I can employ both an MVC framework and REST framework together? Do they make sense together?
I am using Jetty as my web server, so I think that lends itself to using Restlets...?
Anyway, I am not sure how much sense I am making in this post, so I will stop it there for now.
As the previous poster mentioned, it makes perfect sence. MVC let's you separate concerns such that you can keep your application logic separate from your presentational logic.
Your REST controller serves the request you need, populates the model, and exposes it in a REST like manner, typically by returning an xml view to the user. This can be aided by a number of libraries such as xstream, jaxb, castor, xmlbeans, which all provides routines to marshall an object into xml.
Exposing a REST API on the server-side will be a perfect fit for your JS front-end. Your resources will have to expose JSON representations. You will even be able to reuse this web API from other clients such as mobile phones.
As the lead for the Restlet Framework, I can only recommend it for this purpose. Integration with Jetty is very stable :)
Cheers,
Jerome
A quite extensive discussion on this can also be found here:
Separate REST JSON API server and client?
For me it was very helpful.
Yes! It makes sense as Johan Sjöberg said! You can use Spring MVC for example. I like it a lot and think it is very simple and easy to learn. You have an example here.
By the away, for the frontend maybe you would like to check this presentation.
I´ve been developing web appplications using Microsoft technologies for a long time, but now I´m been asked for building a VERY BIG application on a Java Web project. For some reason, I´m being forced for using GWT as the front-end; I´ve read some comments about it where some people says that is not the best option for big/enterprise applications (In this case, is something almost as complex as an ERP). Another requirements are: allow connecting to multiple databases, using a technology for rapid development and having a low performance cost (users don´t like to wait for pages to load)...
So the questions would be:
- Is GWT the best option?
- If so, what´s the best back-end (Java technology) that we can use? I´ve read that it could be Groovy, Spring Roo or JSF.
- Should I user Hibernate, or creating another light-weight option?
Thanks in advance
GWT is a serious framework no matter if it's used for big or small project. Before committing to GWT you have to realize that:
it's a client(browser)-based technology
it's a translation layer from Java to JavaScript where JavaScript development is either eliminated or reduced to a minimum
it's capable of integrating with server (middle tier), especially well with Java-based ones no matter what technology it uses: JDBC, Hibernate, GAE, proprietary, etc.
it's tailored toward Java/desktop developers so expect steep learning curve if it's not your background
it requires fundamental understanding of MVP (variation of MVC) frameworks
it requires familiarity with JavaScript browser technology
big projects with GWT will require using supporting frameworks like GWT MVP, Guice, gin, gwtp, etc.
The good analogy would be Swing or Eclipse RCP. They offer rich GUI desktop development platform while integration with variety of server-based technologies. But the target platform for GWT is a JavaScript-enabled browser, not a desktop.
GWT is a very capable platform and is fitting for projects of all sizes especially since 2.1. The Google Wave team helped the GWT develop APIs and practices that really help in using GWT for large projects. As far as coming from a .NET background it may be a steep learning curve at first, but Google's getting started guide for GWT is a good place to start and you should be able to hit the ground running. One thing that people often forget is that GWT is actually just a compiler that emulates portions of the JRE and in the end it is all just HTML, CSS and Javascript.
For back end technologies there are many options, but there are actually 2 decisions you must make. First you will need to decide on a web/communications layer. The way I see it you have 3 main options for the type of communications before we even get into implementations: GWT-RPC, REST(XML or JSON), or SOAP. I prefer REST with JSON however, if you have no need to expose your services outside of GWT you may be better off with GWT-RPC. If you choose to go with REST or SOAP you may even choose to not use a Java back end but instead use .NET to stay in your comfort zone. To do this I would write an XSD to describe your data model and use .NET to persist and expose your data as JSON via REST. You can then use JAXB to generate a Java representation of those classes for use in your GWT client however you will have to strip out all of the XML annotations and modify them to work as overlay types.
Secondly you will need to decide your persistence layer. Many prefer Hibernate, but I prefer JPA, either will work great for enterprise level applications. The advantage to using a Java back end with GWT-RPC communications is that you can use the RequestFactory with EntityProxy so that you only have to maintain one version of the object from the client through the persistence layer.
First you can't use JSF for back-end
i suggest you to use hibernate for back-end
and jsf for front-end especially the new version jsf2 with the power of CDI
and i recommend you to use Richfaces , Primefaces as lightweight jsf components
and also Seamframeworkas development platform
if you use it i think you will have the most powerful java web technologies
GWT can serve you in big project but it may take double time comparing
with JSF
but if you like GWT you should
Have a look at Vaadin
Jsp or struts ?
In fact I'm even not so clear about the difference of the two framework, or is Jsp a framework at all?
There's also Spring MVC.
Struts, Spring, Tapestry, etc. are MVC (Model-View-Controller) frameworks. JSP is just a presentation layer that is transformed to an HTML tags for display to browser.
Struts is the "grandfather" of MVC frameworks with huge followings. Struts2 is another. Spring is the now-generation of frameworks that includes Spring MVC for MVC as well as other goodies.
All these MVC's allows you to connect to a presentation layer such as JSP, HTML, FreeMarker, etc.
Hope this helps.
Struts is a dead vintage framework. Don't you mean Struts 2? Anyway, there is no "best practice". Just choose whatever framework suits your needs. JSP is no framework, it's a view technology. Almost all frameworks are built on top of JSP/Servlet. Only JSF 2.0 doesn't by default use JSP, but its successor Facelets.
Related questions
Java web development, what skills do I need?
What to learn for making Java web applications?
What's the difference between JSF, JSP and Servlet?
Choosing a Java web framework right now?
If you're just starting out, I'd recommend avoiding the complexity of frameworks.
I started out by learning about web architecture from Martin Fowler's book Patterns of Enterprise Application Architecture. I recommend that more than anything; it will change the way you think and allow you to understand why certain frameworks are the way they are.
The best part of hand-coding using these patterns was that I was never fighting a weird corner-case of a framework's API, and I knew exactly what my entire codebase was doing.
The worst part is that you have to write a lot of CRUD data access code by hand, but this practice will make persistence frameworks like Hibernate MUCH more comprehensible.
A description of all the patterns are available for free online, as well as some excellent papers:
http://martinfowler.com/eaaCatalog/
The thing is, if you buy the book you'll get the complete picture. You can buy it for $30 US here:
http://www.abebooks.com/servlet/SearchResults?sts=t&tn=patterns+of+enterprise+application+architecture&x=0&y=0
One thing I don't remember if he covers is connection pooling/management or the particulars of JDBC. Just remember: ThreadLocal is your friend. It's a good way to use a JDBC connection (and any other request-scoped variables) for the life of a request without having to pass Connections around all the time. You can add pooling later.
And one other thing: JUnit + Apache HTTP Commons + XMLUnit are INDISPENSIBLE for testing. Make sure you run system tests! They will change how you code (for the better). You can assert the input/output of HTTP requests and their responses. Sometimes it's too high-level, but you'll learn when to test at a finer granularity.
They work together. But I would recommend to learn JSP first.
However, you can check out this Struts overview as well. It should give you the big picture.
have you considered Google Web Toolkit?
I recommend trying out Apache Tapestry.
It is easy to get started (read: lacks a lot of XML configuration), easy to refactor due to the templates being closely tied to POJOs and the fact that is based on sensible conventions yet allows you to change these is a definite plus.
The two biggest quarrels I have with it are that it has stringly-typed #Validate annotations and searching for "tapestry" sometimes brings up a lot of information about tapestries.
There is a good tutorial over at http://tapestry.apache.org/tapestry5/tutorial1/index.html.
I want to develop a web application, like an online scheduler. (Yes I know it's been done a million times.)
Most of my experience is in Java, so I want to leverage that when considering technologies.
I've primarily been a systems developer with little exposure to UI programming, so I think this is where I will need to do most of my learning.
Do you have any suggestions on the technologies I should focus on? I want to focus on technologies that are marketable and easy to learn.
So far this is what I think I need for a 3-tier architecture (from the ground up):
Database (likely MySQL or PostgreSQL) - SQL, JDBC
Back end server - Java
Web server (Tomcat) - JSP, Servlets
Web Framework - Tapestry (weak on this, any better alternatives?)
Browser technologies - HTML, Javascript, CSS (need to learn)
I've heard about "Rich internet application" development tools such as Flex and Silverlight, but I'm not sure about the market for such technologies.
Edit: Seems like there's a lot of mention of Spring/Hibernate, so I'll look into that. I appreciate the feedback.
I think you've got your bases covered pretty well.
You'll probably want to look into some frameworks / libraries to make it easier on you.
Web Framework - Wicket / Stripes / JSF / Tapestry (component vs request based frameworks)
Javascript Library - JQuery / YUI / Dojo
As for your template language you could use JSP / Velocity / Freemarker.
Just study up on the frameworks and tools maybe try a few out and see which ones work best for you.
Just FYI I'm currently using.
Apache - web server
Tomcat - servlet container
MySQL - database
Stripes - request based web framework
YUI - for ajax
Spring - dependency injection
Hibernate - Object Relational Mapping
jsp - to dynamically generate html
I'd personally add Spring to this list. Dependency injection is definitely a great technology to learn, and Spring lets you use it as much or as little as you like, in my experience.
You haven't explicitly mentioned unit testing, but that should certainly be part of the mix - I don't have much experience outside JUnit as an actual testing framework, but there's also EasyMock and JMock (amongst others) for mocking of dependencies.
None of that's web-specific, but still important stuff IMO :)
I would have to disagree that there isn't a market for Rich Internet Application. There is actually a growing trend in enterprise size applications being made as RIAs. The advantage with RIA over normal web applications is usability. You get all the advantages of web application but still are able to keep the desktop-like user interface.
You say you come from a Java background and haven't had much experience with web technologies. Well, I have to say that you really sound like an ideal user candidate for either GWT or IT Mill Toolkit (based on GWT). Both are frameworks which allow you to create rich internet applications purely in Java! No HTML or JavaScript skills required. You will have to learn CSS to make your own theme for the application.
Both the frameworks are open source and suite very well for commercial use. What separates IT Mill Toolkit from GWT, is that it is server driven, meaning business logic is implemented and ran on the server rather than as JavaScript in the client browser (which is the case with GWT). This server-driven architecture makes the application much safer from a software security point of view. The advantage of GWT over IT Mill Toolkit is the larger user community.
What comes to the ORM frameworks, Hibernate is quite popular. However, I'm not very fond of it, because even though it technically implements Java Persistence API, it doesn't always behave as expected and you'll have to use a lot of hibernate specific annotations, which ties your application pretty hard to hibernate (bad thing!) and you cannot just easily swich to another JPA provider if you'd like to. Antoher ORM framework implementing the JPA is EclipseLink. I haven't personally used EclipseLink in enterprise size applications (because I still haven't had the chance to), but I'm using it for a smaller project and it seems to be quite nice. EclipseLink is open source and its lisencing is friendly for commercial use. EclipseLink is continually developed by Oracle, so its backgrounds are solid. It is actually based on TopLink, which is Oracle's closed source JPA implementation.
Hope this helps :)
Asked basically the same question some time ago, with some pretty useful answers:
Tools for website development
If you are going the with a Java back-end, I would recommend Hibernate for your JPA, JSF with RichFaces (AJAX/skinning) and Facelets (view rendering/templating) for your front-end, and Seam to put it all together. It's a wonderful combination.
If you go with Spring, then you may just use Hibernate going to mysql, and you can have everything you need there.
After you write it, and you want to start improving on it, then perhaps start looking at doing more on the browser side, but, initially, you may want to just have it be without ajax calls.
The Spring Framework documentation may be helpful, as there are many parts to Spring that you can use, optionally, such as Spring MVC, Spring Framework, Spring Webflow and Spring Security, if needed.