Technologies required to build an end to end web application? - java

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.

Related

Explain: How does Java work as a web application?

Ok, I know this is a vague question, and I expect a vague/basic answer.
I am well versed with PHP driven MVC frameworks and how the process of serving pages works. I'm very interested in learning Java, and I figure the only way to learn it is to do it. However, after reading page after page after page, it gets more confusing as I read.
I'm running into GWT (front end), Hibernate (ORM connection?), Spring Architecture, Spring Roo (what is this?), JBoss (servelet), JPA (ORM), POJO (a style of using regular java objects with orm?), Maven?
My basic question is how do all of these fit together? I like the idea of using a framework, because it's worked well in the past with PHP. How do I use this functionality with java? Suppose I wanted to build a web application with a relational data store. How does java authenticate, initate a session, and serve pages with dynamic content? What is the process?
When responding, please don't say "stick with what you know," (as I've seen on other pages) because I'm very interested about java and I'm trying to learn.
I totally hear you - too many acronymns have propped up as Java EE has evolved.
I will try to put an explanation
Java is the language
Java EE (Java Enterprise Edition) is the general term used to encapsulate all Java technologies that help create an enterprise/web application with Java
So a typical web application with Java looks like follows:
Front End
Use JSP or JSF for server side processing and rendering (JSP and JSF
offer ability to define your UI using HTML and server side tags that
bind easily with your Java Beans) However they do tend to mix UI with
backend if not implemented correctly
you can also use plain HTML and any client side toolkits for rendering (such as jquery, dojo, extjs or flex) and fetch your data
from the Java EE server.
you can even mix the two (use a client side framework in a JSP to achieve best of both) or use a toolkit like GWT that offers client side richness with javascript with Java APIs and ease of accessing your java beans
Middle tier
Java Servlets offer the base for all server side processing with Java EE (Servlets offer session persistence, HTTP request processing, response processing) and typically offload the business processing to a model bean - which could be a POJO or spring bean.
Servlets are Java programs you write and are executed in what is called a Java EE container. Popular containers are tomcat, IBM websphere, BEA Weblogic
To help implement a good MVC architecture, there are several frameworks and tools provided on top of Servlets:
Struts2 and Spring MVC are examples of such frameworks
To make it easy to implement web services, Restlet/Jersey help with REST based web services, JAX-WS/APache Axis help with SOAP based web services
Integration with backend database/persistent store
You could use JDBC in your POJO or other model bean to access the DB using Java.
Or alternately use one of the frameworks such as Hibernate to make it easy to interface with the DB backend
Sun's petstore application is a good place to start to learn how the pieces fit together
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-eedocs-419425.html#7522-petstore-1.1.2-oth-JPR
Build and Deployment
Ant and Maven are tools used to build your app and manage dependencies
the application gets packaged as a WAR or EAR file and can be dropped into any Java EE container to deploy it. Once it is deployed, it can be accessed using a URL
Tools like Eclipse, Netbeans, Oracle JDeveloper offer integrated IDEs to help with local deployment and testing
The good part with Java EE is that you can pick and choose the components you want to use to build your webapp.
The problem Java has is that it's fairly old and there are TONS of frameworks and packages that do similar things as other packages. At the very core, however, is the Servlet, that specifies how Java behaves as a server over the HTTP protocol.
With that basic building block, there are lots of web frameworks like Struts, and Spring MVC that build up layers of functionality by using lots of good OO development patterns, like Fiters, Delegates, Factories, MVC, etc., to allow the developer to put together an application that takes web requests as input and returns a web response as output.
Those frameworks often build on other frameworks or packages to give application developers more capabilities at different layers of the application. This includes things like ORMs (like Hibernate) to talk to relational databases, or view compositing frameworks like Tiles or Velocity to help put together an HTML page as part of the response.
There are lots of other acronyms and tools and layers that get built up around web frameworks, but essentially they are all just programming tools that have useful functionality pre-built and just need to be used.
If you are looking for a more packaged web application development framework that is more cohesive and doesn't make you feel quite as lost, you may want to take a look at Grails. It is in Groovy, but it is very close to Java in terms of the language and actually builds on top of lots of the other tools you have heard of.
Grails itself builds on the Spring and Spring MVC frameworks, as well as Hibernate, so it's using the same technologies as other more pure Java frameworks, but it abstracts the ugly details away so you don't have to worry about them unless you want to. You can then bundle in additional functionality, like authentication / security, through plugins. If you are well versed in PHP-based MVC frameworks and how they work from an architecture standpoint, you will feel right at home in a similar MVC environment like Grails or Spring MVC. The Grails User Guide is a great place to start, and the rest of the documentation is good too.
If you are new to the Java language, I would strongly suggest doing a few small applications (not web apps, just simple ones) to learn the language and get familiar with how things work. Java is very different from PHP, since PHP bundles in a lot of the base functionality into the language whereas Java has a fairly sparse language with much of the commonly used functionality coming from libraries.
Once you have a good grasp of the Java language, I would jump right to the Grails framework and I would skip all of the nitty-gritty details of servlets and ORMs and Hibernate, etc. at first because you don't need to know it all and there is so much there that it can get in the way of actually understanding things.
Then, once as you start to build out an application with Grails, you will gradually get a deeper understanding of the technology Grails is built on in order to do more complex and powerful things. Slowly, you will work your way into Spring and Hibernate and build up an understanding of how things are put together under the covers, but you can be doing real things faster since you don't have to know all of that from the beginning and can quickly make web applications in Grails the just work, especially with an understanding of the MVC architecture pattern with respect to an application responding to a web request.
Wow, not only is this an open ended question, but it could have pages and pages of answers. I worked in php ~ 7 years ago without a framework so I'll try to point you in some starting directions and compare my experience (which is outdated and sans framework!)
You need an application server just like your Apache server for your Java web app, such as Tomcat, Jboss or Glassfish. These servers handle serving dynamic content.
On top of the server you have your web frameworks which you've mentioned GWT, Spring, and Spring Roo. Spring Roo is like Rails, but in Java. GWT goes all out and and will write your html/javascript code based on your Java code.
In Spring You can define objects to be used in your forms and then when they are submitted the entire object is passed back so there is less work. I remember the days of getting a lot of $_POST[] stuff and I'm thankful not to have to do that when using spring. There is Spring Security that you can use for auth.
The web frameworks are configured to connect to the database and then there is the database abstraction ORM, Hibernate. In PHP I used EZSQL for abstraction which didn't contain nearly the amount of features Hibernate does. Hibernate has a steep learning curve, but is worth learning.
For dynamic GUI's you'll probably want to research JSP, but may be interested in learning JSF.
If I were you, I'd pick an application server, maybe tomcat, then a web framework to play around with, personally I'd go with Spring. The framework will probably have dynamic GUI examples so you'll pick up jsp/jsf. Then possibly add the ORM and a build tool to build externally from your IDE, such as Maven, Ant, or Gradle.
There are some very mature java libraries that each target a very small need in a web application. This means that many tutorials on the subject will have to pick and choose the libraries for each need. For someone just starting out from your position, this probably sucks.
Naively, then, I searched for "java full stack framework" and found: Full stack framework for Java
The benefit of a full stack framework is that you don't have to choose each component. The framework has strong (perhaps rigid) opinions on how ORM is done, how templating is done, how mapping URLs to functions or actions is done, etc.
As for your list of technologies and acronyms:
GWT - a framework from google that focuses on the front end. Poorly stated, write your front end functionality in Java and have it magically transform into javascript.
Hibernate (ORM connection?) - yep, store and load objects in your app.
Spring Architecture - Spring is pretty close to a full-stack framework, but it doesn't have as many rigid opinions on things. You can swap out templating engines, swap out ORM, etc. Not a bad framework, though. You might want to simply follow a tutorial on Spring (see below on Roo), and use the components suggested by the tutorial. Just know that you might find something else later that fills a particular niche.
Spring Roo (what is this?) - Spring Roo takes Spring and becomes opinionated (use what we say). This allows for less code on your part because it provides the code that integrates the various components. It still allows quite a bit of flexibility when you want to change something. Bonus, it comes with a nice tutorial.
JBoss (servelet) - Usually I think of JBoss as an application container. Since the Java EE spec is a bit more complicated than simple CGI--there's a lot of things that need to be set up by the web server (loading classes, loading configuration files, connecting crap together)--JBoss does that stuff. Alternatives are Tomcat or Jetty.
JPA (ORM) - Yeah, it's a common set of interfaces that the various serialization providers might implement. It might be a database, it might be something else. But the idea is that your code for storing and retrieving objects would look the same.
POJO (a style of using regular java objects with orm?) - In context, probably. "Plain Old Java Objects" are nice for any library. Sometimes a framework might require that you inherit your classes from some special class, like Model or Controller to work properly (also, HTTPServlet). This isn't good, because it restricts your own class hierarchy design and makes your own code less flexible. Consequently, things that work with POJOs are considered better.
Maven - Maven is a tool that helps manage dependencies. Without it, java has its own form of DLL hell. Library A depends on version 1.1 of Library B, but Library C depends on version 1.5 of Library B. Ohhh crap, time to read through a tutorial on classloaders. Don't worry too much, though, any tutorial on java web apps is likely to tell you exactly what you need to download and use.
The first thing I would suggest you to start with, given a knowledge of http protocol, is the JSP technology. Although you would probably use some framework like JSF2 for instance, it is important to start with JSP in order to well understand the technology and how to use it to deal with request/responses (that's my humble opinion of course).
Once you are familiar with JSP and, let's say, JSF 2.0 (you can find loads of documents on that topic) the next step is to try to connect with a data source. In Java EE technology there is a specification called JPA (Java Persistence API). JPA is just a specification for ORM (which is, roughly speaking, mapping an object java model with a set of DB tables)
Once you have your web application working with some basic pages and some operations on a DB you could enforce the security of your app introducing some security mechanisms.
this is a very good reference and start point for all of these topics and much more. It's a long path and it will take you some time. But, believe me, it's worth it!
Good luck!
I suggest you google those keywords and look for some books and tutorials.
Maven
is a tool for managing your Java projects and artifacts (JARs, WARs, etc.). I'd start learning Maven first, so that you have a foundation to create your Java projects on. It also handles your dependency management: you just specify what JARs you need in your application and Maven will download them for you.
JPA (Java Persistence API) handles the Object-Relational-Mapping of your entities. You can write POJOs (plain old Java objects) and map them to your database tables.
Hibernate is a JPA provider (i.e. implementation of JPA). Usually you don't have to deal with Hibernate that much, most of the time you can use JPA directly. You just configure the JPA provider in the persistence.xml config file.
CDI (Context and Dependency Injection) see description. CDI "wires" the components of your application together.
Springframework started as a framework to offer Dependency Injection capabilities, but today it's much more than that. The WebMVC module of spring might be interesting to you. You can write Controllers and Views (using JSP for example).
Servlet API A servlet acts like a little server, handling a HTTP request and generating the response. You can write your own servlets or use a web framework to do it's job, for example Spring's DispatcherServlet or Java Server Faces, or whatever framework.
JSP is a technology to write templates for your HTML files. JSP files are being compiled into Java classes and can contain HTML code, JSP-specific XML code and Java code.
Example:
<ul>
<c:forEach items="${countries}" var="country">
<li>${country}</li>
</c:forEach>
</ul>
renders a list of countries, where ${countries} might be a collection of country objects (or strings in this case).
JSF (Java Server Faces) is another framework for building web applications, utilizing JSP and/or XHTML for defining the views and backing beans for the backend part. I would start learning with JSP instead of JSF, it's easier to learn.
Most of the frameworks are part of the JavaEE standards portfolio. For stuff like CDI to work you need either an application server (like JBoss AS) or at least a server with a servlet container (like Apache Tomcat or Jetty) in combination with Spring.
Spring and Hibernate are not standard, but they implement many of the standard APIs nowadays.
**EDIT: ** you might also want to learn about Annotations in Java code. They are around since Java 5 and are widely used as an alternative to XML based configuration.
So my suggestion is that you start learning Maven (not necessary tho, you can also manage your project manually), then Spring and JSP to be able to create a simple web application and then JPA/Hibernate to make your data persistent.
In my opinion learning Spring is much easier than learning the whole JavaEE APIs, since Spring is quite good documented.
One of the nice things about GWT is that you'll right your client code in Java, with all of its benefits and if you have server code, that could also be in Java as well, and you could share some of the source code, even if the front-end ends up running as JavaScript.
TO build a basic Java web application, go through this tutorial as it will explain the core foundational technologies with the standard Java EE platform and how to develop something real with them.
http://netbeans.org/kb/docs/javaee/ecommerce/intro.html
It will demonstrate the standard Java web technologies such as EJBs, Servlets, JSP, JPA, and how to use Netbeans for your IDE.
Most beginner's are very overwhelmed by the thousands of different technologies and platforms out there with the Java EE framework. Java caters to a very 'open source' type of community and that means that you have ALOT of different choices and road maps on how you can build applications. This is very different from say the .NET world where everything is pretty straightforward and there's a very clean cookie cutter path.
Once you have learned these foundational basics by going through the tutorial, you will have a grasp on what the Java EE framework. Once you understand these basics, you can then start to learn about Maven or Spring and how those type of technologies can help you build better applications and you can make better and more educated decisions.
GWT - Web interface tools. Some competing technologies: Spring, JSF, Wicket
Hibernate - ORM mapping for databases. Competing technology: JPA
Spring Architecture - Web Framework. Competing technology: JSF, Wicket, GWT
Spring Roo - An MVC style flavor of Spring.
JBoss - Application hosting. Competing technologies: Glassfish, Tomcat
JPA - ORM mapping for databases. Competing technology: Hibernate
POJO - Plain old java object. Just a simple object.
Maven - Maven is a way to manage libraries or dependencies that your project uses. There's a central server that hosts many of these libraries and if you ever need to import a new one to use in your project, it's as simple as searching through the server and then copy and paste the configuration settings that they provide you into an XML document called the POM file or pom.xml
Vijay's answer above is pretty much spot on. I'll elaborate on a few points.
Most of the "fameworks" that you mention, spring, roo (which is just a way to work with spring), gwt, struts, etc. all work on top of "Java EE". Java EE is Sun (now oracle's) term for the "standard" way to work with web applications. Java EE also includes a lot of more enterprise stuff like EJBs, JMS, JMX which you won't really need to concern yourself with unless you're doing very high end stuff.
JSP is the part that will be most familiar to you coming from PHP, it's a way of embedding code inside of an HTML page.
Servlets are the middle tier, that's where database connections are created and application logic happens. As it turns out, JSPs are converted into Servlets at compile time.
All Java EE stuff runs inside of a "servlet container" or an "application server". That's the big difference between java and php. Your choices here are usually Tomcat, JBoss or Jetty.
Maven is a build system that helps you to manage 3rd party jar files (libraries) and compiles and runs your test codes. It has plugins to deploy your code to tomcat/jboss/jetty.
POJO stands for "Plain old java object". Most modern frameworks try to shield you from the complexities of what happens under the hood and let you work with "POJOS". This comes into play when working with something like spring or hibernate. You may also see the term "java bean" tossed around, that's a standard way of defining "pojos" that just sets up a convention about how to name getter/setter methods and constructors.
I would recommend getting a book on getting started with JSPs/Servlets and starting there.

Current core technologies for AJAX w/ Java?

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.

WHich is the best path or flow to learn java from web site perspective

I have just started learning java and i have about 8 months time. My main aim is to build web application using java. But as there are many java technologies/frameworks available i am conufused how should i go
IDE i am using is eclipse
The path which i am thinking is below
1)Learn Core Java
2)Project: Build Java Invoicing System with JDBC or mysql to test java knowledge
3)Learn Servlets / JSP to
4)Build small site like simple logon/memberarea/catalogue using servlets/jsp
Now guys I really don't know where the following things stand in my path and which things they will help
1)Java EE
2)Spring or spring MVC, what's the difference?
3)Hibernate
4)Wicket
5)Struts
I really don't know how should i learn those and which things to choose from.
what should be my final project which can be build using those because if i see from my current stage even website can be build using servlets/jsp. then why do i need those other technologies
Can anyone give an example of a project which can be build using new technologies and not using jsp/servlet, so that I can get an idea why we need those?
Lot's of stuff to learn in here so I would take it a bit at a time. I'm going to assume you are relatively comfortable with the Java language and core APIs.
First learn about JDBC and databases. Get a basic functional JDBC example app working (not visual just some a vanilla Java app) that does read/insert/update/delete of some records in a table. This will give you the basis for building whatever app you choose. Almost all interesting applications involve some sort of persistence/database.
Learn the main JDBC APIs (Connection, PreparedStatement, ResultSet) and write some code that uses these to get comfortable.
Learn about how transactions work in databases if you aren't familiar already and how JDBC uses them (Connection.commit and rollback)
Next you could look into the spring framework. This has a several useful features that come in handy when building these applications. The main ones to get to know the dependency injection functionality and the JDBC libraries it has. The DI stuff is a bit of a "duh"? if you haven't used it before but it is very useful/powerful especially for medium size + apps. The JDBC libraries help with the cruft of dealing with the raw JDBC APIs and make your code less error-prone.
Once you've got some basic JDBC and Spring stuff worked out you can then start bringing in a web framework.
This is more difficult because there are so many. In the interest of getting something up and running quickly I would probably go with Wicket. It runs inside a servlet container like Jetty, easy to get up and running with a basic web page or two and relatively easy to evolve of the project over time without going down too many blind alleys. I've found that frameworks like JSF (the Java EE default web/view framework) takes a lot of up front time investment to get going on. Most of these frameworks, including Wicket, can leverage the spring stuff you've got above.
Avoid JSP, it's unpleasent technology and outdated by virtually everything else.
To answer some of your other points.
Hibernate is a tool for mapping an object model to a relational model. In it's most basic form you define a Java class for each DB table with the class having one Java property (variable+getter+setter) for each DB column. You can also add references from one class to another to model database relations. It is good but it takes a bit of getting used to.
Spring I've explained partly above. Spring is much bigger than just DI and some JDBC libraries. It also has transaction management libs and bunch of other stuff. Spring MVC is a web framework which lives under the spring umbrella and makes use of a lot of the spring libraries internally. I've never used it so can't offer an opinion on it.
Java EE is an umbrella term for a large set of "enterprise" specifications/libraries. JSF is a web view framework that is part of Java EE.
That's my very high level advice. To summarise I would learn basic DB/JDBC then some spring stuff and then start building a basic web app using what you've learned already.
Hope that helps. There's plenty of info out there on the web on all these topics and you can always ask questions here on more specific parts if you need help. Good luck and enjoy!
EDIT (to address comment):
All of the above is my recommendation/opinion on how to approach learning Java web development.
In summary
Learning JDBC/transactions/databases is a must
Spring is optional but I strongly recommend. Spring is a big library but you can pick and choose the bits you like/need.
Web frameworks the choice is really yours. From what I have tried (JSF/JSP/Wicket) Wicket is the easiest to get going with so you don't spend too much time frustrated with the getting the initial setup. JSP is awful, it's very easy to make a mess with it. JSF is powerful but heavy and probably more suited to very enterprisy projects than a first web app.
Hibernate is optional but can make life easier simply because you can work with Java objects when you do DB queries/updates rather than writing tedious insert/update statements. Hibernate isn't the only tool like this but it's the one I've used most and does the job well. Just don't go too overboard with the "clever" hibernate features initially.
You could easily use Spring MVC instead of Wicket. That may be a perfectly good choice, I've not used Spring MVC myself so can't comment. I'm sure it will integrate well with spring stuff tho so that would certainly be a positive factor.
Do some more research if you're not sure, there's no end of people happy to give their opinion! But really you just have to dive in and try something.
You are correct. If all your applications are served by servlets, JSPs, and JDBC, then maybe you don't need to learn anything else.
I commend you for learning the fundamentals first before diving into a thicket of frameworks that you don't understand. That's a good thing.
But if you reach the point where you have those down cold, maybe looking at these other technologies can help you improve your game.
1)Java EE
You are learning (part) of Java EE when you use servlets, JSPs, and JDBC. They're a subset of the full Java EE machinery - EJBs, JMS, JNDI, etc.
2)Spring or spring MVC whats
difference
Spring is an alternative framework developed by Rod Johnson and Springsource, now part of VMWare, that is based on dependency injection, aspect-oriented programming, and framework modules. Spring web MVC is one module in the Spring framework, based on servlets, that acts as the front end for web applications.
3)Hibernate
An object-relational mapping technology (ORM), built on top of SQL and JDBC, that lets you map objects to tables. It has its own object-based query language.
4)Wicket
Another web MVC alternative to Spring MVC, Struts, JSF, etc.
5)Struts
The first web MVC framework. It's gone through versions 1.0 and 2.0, and has now been supplated by Java Server Faces. It's still used, though. Like all other web MVC frameworks in Java, it's based on servlets and JSPs.
From a Java perspective it might be best to start looking at Java EE. All the others you mentioned are alternative technologies, which might be useful to you if you decide that what the standard framework offers isn't your cup of tea. But for that to decide, it's never a bad idea to at least know what the standard framework is about.
Truth be told, before 2006 the standard framework had a bad reputation and some of the sentiments that form the basis for recommending alternative technologies are still based on that. Starting with version 5, Java EE got dramatically better. The latest version, Java EE 6 is arguably one of the best Java frameworks that's out there. Of course, the best is a highly subjective term and naturally it won't be the best one for each and every person out there.
At any length, Java EE 6 is a very complete framework that allows a large range of application to be written without depending on any additional library. Being the standard framework, most other frameworks at least depend on some parts of it.
Most typically EJB, CDI and JSF are replaced by alternative technologies. E.g. the core Spring container replaces EJB and CDI and Spring MVC replaces JSF. A full Spring stack typically still uses JPA, JTA, JMS and Servlet from Java EE. Wicket on its turn only replaces JSF, or when used with a Spring stack replaces Spring MVC.
Hibernate is a special case. It doesn't replace anything from Java EE, but is instead often used as an implementation for one of the key APIs of Java EE: JPA. The original creator of Hibernate, Gavin King, is one of the prime supporters of the Java EE framework and is in fact the spec lead of one of the most important parts of modern Java EE: CDI.
Wicket by itself is a very nice web framework, but in practice it isn't used as often as JSF. I won't go into the discussion whether Wicket or JSF is 'better' (this is mostly a religious battle anyway), but due to the popularity of JSF there are simply more people experienced with it and there is a large community offering many things for JSF like component libraries and extensions.
Struts has historically been completely replaced by JSF. The original creator or Struts, Craig Mcclanahan, was the one who started JSF as the successor of Struts. Nevertheless, Struts was once the absolute de-facto standard for web frameworks in Java. It's not often advised to be used for new projects, but till this day it's still used in a huge number of existing applications. So even though it's not really 'hot' to learn Struts anno 2011 knowledge of it may still be very practical for when you have to maintain existing applications.
ps
See this answer for a general description about Java EE: Frameworks for Layering reusable Architectures
I'm sure that nobody seriously can tell you the best way, because this would mean that (s)he would have tried all. Why do you want to learn a Java web application framework? Just to learn it to be prepared for the (next) job? In that case it is likely that you've learned the wrong one.
The next question would be what you want to do with the web application framework. Do you want to make a website a little bit active, e.g. make each page look similar (corporate design), auto-generate menus from an internal structure, or do you want to write a real web application, e.g. with database access.
I'd first define the goal what you want to achieve. IMHO a good way to motivate you to make it right is to take a small project which helps you to solve a small problem.
Then I would start with Java Server Pages (JSP) and servlets to understand the basic concepts. Then you can try to do the same with a few well-known web application frameworks, e.g. Wicket.

Is GWT OK for this? if so, what´s the best back-end java technology that we can use?

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

Which Java technology should I use, if I want to build a website with thousands of users?

Sorry for asking this question, but I searched all Java-related questions, but I got more confused. I am still not clear what should I start with.
My main thing is building websites in Java, because someone told me that there are some machine learning or AI libraries available in Java which I can use in Java. So I decided to use that as it can reduce my work.
Now I don't know Java at all. Some people say the following are used to build websites, like:
Servlets alone can build a website
JSP alone can also build a website
Struts
Spring Framework with Hibernate
Seam
Java EE also for websites
I am confused. Where should I start from? Where does core Java fits in here?
I was thinking of perhaps learning Python as I know I have to learn Python only, not its variations.
So please guide me to one thing which can solve my basic purpose of using ready-made libraries of AI.
If I can do that with JSP then I will start with that.
But if I need to learn all of them, then it’s better if can start learning Python.
I have five months to finish the website.
I really don't know why there are many branches of Java for doing one thing.
To correct some misconceptions of yours:
servlets and JSP are Java EE
Seam and Struts can be used together with Hibernate as well
Spring MVC is a web framework. Spring as a dependency injection framework can be used together with any other framework.
there are many more options, like JSF, Tapestry, Click, Play, etc.
It depends on what will the site will be doing, but you can choose any.
Experience has shown that building complex HTML forms (especially validation) and Ajax functionality is hard to get right. You will most likely appreciate having a library to assist you with that. The same thing with database access.
Everything builds on servlets. Learn those in order to understand the libraries you will use.
I would suggest learning JavaServer Faces (JSF) with facelets. The easiest, while being powerful, is JSF 2 in Java EE 6. The easiest way to get started is to use NetBeans with GlassFish 3.
For static web pages, HTML alone is enough and if you want to make it more user-friendly and interactive, use JavaScript.
There are lot of frameworks you can use directly in JavaScript, like jQuery. Now if you want to make some more functionalities, like database interaction, then you will need either PHP, Java (JSP and Servlets) or .NET (there exist some more, but I’m aware of three only). Each of them have their library to interact with database.
Since you are interested in Java, go through Servlets, HTML, JavaScript, and JSP. Once this is done, you can look into JSF and EJB beans. So if you have knowledge of Java this will not take too much time, because the syntax is the same; the only difference is the concept.
So you will have a frontend (HTML, JS, and JSP) which will interact with the backend (Servlets and the database) which will be deployed in a Web container. To deploy, you can use an one of the available application servers, like Apache Tomcat, GlassFish, or WebSphere. To develop your application, you can use Eclipse as the IDE, which is one of the best IDEs I have used.
So decide your architecture and design, break it into components and start writing small applications first. Once you are experienced in small application, start writing an application where there are more things you have to care of, like load on database, availability, security, etc. For that, you can refer a very famous question on Stack Overflow, What technical details should a programmer of a web application consider before making the site public?.
The closest to core Java is servlets. No extra syntax, very minimal library, but no included functionality.
For building websites, the main thing is HTML and HTTP.
All technologies (including Enterprise Java or Server side Java) do the same—to understand an HTTP request and respond back with HTML. All that you mentioned do the same thing with a different level of sophistication.
Start with Wikipedia.org to know what technologies do what. If you are completely new to Java, go through the Sun tutorials, do sample programs, and get comfortable with Java packages, JVM and classes. (This might take a week or two).
To build websites using Java, you'll have to learn Java Servlets—everything else (JSP, Struts, JSF, and Spring(!)) are built on it. Get Head First books on Java and Servlets; they will be useful.
You can always build the page in Ruby or something that will give you a website very fast. For the AI stuff that analyzes the bought items for the recommendations, use something unrelated to the page that only takes the database to work with.
I would not mix the whole web page stuff with the AI computing. You can do the AI things that will take a long time and maybe should done on a different machine to have your webpage also responsive with C++ or Java in normal applications.
Choosing your front end technique because of later usage is a very dangerous thing. Using the whole Java EE concept and learning it from scratch will take you much longer than have a quick start with your page if you do it in Ruby or PHP.
You can then build the first version of the page and generate a user base. Start working on the AI stuff once you got some data with other technologies.
If your page has performance problems because your technology does not scale, you can always begin switching parts of the stuff out with a faster technology or maybe simply a bigger machine. Get your page running before you build it bulletproof for the thousand users you are expecting.
If you’re trying to build a website from scratch, with no prior knowledge, your best bet is to go with frameworks that provide a complete stack for web development.
If you aren't dead set on Java, you could probably start learning Ruby on Rails, which would be easier to start with (if so, go buy a Ruby on Rails tutorial which goes through all the necessary things for modern web development, from MVC to version control).
For Java, try:
Play Framework is very similar to Ruby on Rails. It will get you started very quickly, and hopefully (if you follow conventions) handle all of your peripheral needs.
Spring Roo is a very-fast-to-work-with framework, but it might get hard to maintain and extend later on.
These two are full web frameworks, that is, they handle database, MVC (presentation layer), configuration setting, etc... (I'll explain shortly). And could even ease your deployment process.
If you're going to go through any other route (using several frameworks together), you are probably not going to finish what you are doing in five months.
To understand why, and to clear some things you wrote in your question, you need to understand that modern web development (and enterprise development as a whole) is comprised of several different technologies:
Presentation: the term web frameworks has been more or less taken to mean frameworks that deal with this side of web development, i.e., how to create a web page (an HTML page). Most of the frameworks offer an MVC like approach (which you can read about elsewhere), and this is what most of the frameworks/technologies you gave sit in—JSP and Struts (which uses JSP) are examples of web frameworks. Servlets is a lower-level API that standardizes how to answer HTTP requests (which JSP and Struts sit on top of).
Persistence: being able to show a webpage doesn't mean squat these days if you can't save data to a database, and that is what the persistence frameworks do (they ease the way you can save data to the database). Hibernate is a persistence framework.
For Java there are also dependency injection (DI), which is what Spring DI is. It's tough to explain DI to people not familiar with the troubles of Java, so I won't try to explain it, but it's a very important part of modern Java development.
apart from these core technologies, there are also many items that you'll need to learn to actually deploy the application (unless your using services like Heroku or Google App Engine, which should simplify things), and troubleshoot it later (understanding how concurrency and HTTP works).
To address the other technologies you brought up:
I've never really touched Seam, so I'm not sure, but it looks like a collection of other frameworks (mainly EJB 3, which itself is a collection of APIs, and JSF).
Spring denotes a popular open source group (the SpringSource group) that provides various technologies, but most likely when you hear about it they refer to two things Spring's dependency injection (DI) and Spring's MVC (which is a web framework).
Java EE is merely a collection of high level APIs which other technologies implement (Hibernate implements JPA which is part of Java EE for instance).

Categories