This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
First let me apologize if the topic doesn't belong to this section.
I'm a student and I've got to make a university project. Generally speaking, what I want is a web app that would allow to deal with some data in a database with standard CRUD-like operations and provide a childish API to make this data available from some other clients. Essentially, nothing special, but not for me. I decided to make it Java EE-based since I've been learning Java for some time. Sure I know you should first take an overview of all the technologies to choose the most suitable one, but I'm obviously not in the position to show my expertise (or lack of it, which is definitely more plausible). The problem is I'm a little bit overwhelmed with a set of technologies constituting Java EE and related ones and I guess I may not need to study the whole thing now. So the main task is to finish my project and the secondary one is to gain skills needed to work as a Java EE developer with a help of this project.
I decided to utilize some sort of MVC pattern with my project. As far as I understand I need servlets as Controllers, some plain Java classes as Model (business logic). Maybe I should use Hibernate to get some experience with this framework. And I'm a little bit stuck about the View. JSP/JSF/Template Engines? Does GWT belong to this layer? As a possible hint for this part I would like to use Google Maps API in the web page to superimpose my data on the map.
I clearly don't want to be a typical student type asking someone to do all the work. I'm accustomed to self-education. I need a direction and a helping hand. I'd appreciate any advice. Thank you in advance.
You already realize that the choice of frameworks and technologies is normally based on lots of factors, and that there is no "best" approach - that's good! I think wanting to sidestep that process is reasonable for a student project, so I'll make some recommendation that IMO you can't go wrong with, and comment with respect to later applicability.
For the web app, servlets and JSP are a good way to start. Other template engines (FreeMarker, Velocity) and other frameworks (GWT, JSF) are not used widely enough that you'll necessarily ever come in touch with them later- It's good to know different approaches, though, so if you have spare time learning a very different framework (GWT, Play, Wicket) would be a good educational experience. If you want to use a bit more than "naked" servlets and JSP, check out the FrontMan framework that implements MVC; it has the advantage of not doing a whole lot as far as web frameworks go, which means there isn't that much too learn (and it sounds like you have much to learn anyway). For learning servlets and JSP I recommend to get a book to more it a structured learning experience, maybe something like Head First Servlets and JSP.
If there's DB connectivity, you'll want to learn JDBC, the standard Java API for accessing DBs. It's very common to use an ORM API on top of that (maybe JPA or Hibernate). If you have mastered JDBC and have time for more, I'd probably go for JPA (the standard Java ORM API), but the Hibernate API is conceptually similar, so if you know one you should have few problems picking up the other.
First let me apologize for not giving an immediate reply: i've been on a foreign trip.
Your answer has definitely cleared a certain amount of vagueness! I'll stick to my initial plan of learning Servlets and JSP. I'll leave specialized frameworks for later since they should be chosen for the particular project.
I'll post more questions as I advance with my project. And again -- thank you for your answer.
I've stumbled over the Model-View relationship in MVC. There's a small diagram in HFSJ that shows Controller between Model and View with V and M not knowing anything about each other. That's how I wanted to design my app. But it turned out that it's more an MVA (M-V-Adapter) pattern than the MVC since View doesn't talk to Model. Is that right? I don't want to ask a vague question but I don't really get what are the advantages of mixing M and V allowing them to talk to each other if this could be done using intermediate controller.
For the university project starting with plain JSP should be enough - the MVC concept works OK for whole pages. The next step depends on what your aims are - another university project, deeper understanding of MVC or future job security. For the latter you'd better choose the most complex and most widely used of technologies. For a deeper understanding you have to move towards component oriented frameworks - those that support MVC pattern not only at the page level but at the level of reused components - like Wicket, Tapestry, JSF or HybridJava.(As far as I know Spring MVC, Play, Velocity, Struts2 are not component oriented enough.) You have a chance to dive for years in studying technologies so for your being with the university choose the most simple thing - IMHO that is HybridJava.
One of the things I wanted to achieve was to use industry-popular set of technologies. Maybe the whole project structure would be awfully realised but I really want to scale a real-world set of technologies to my university project. This is my contribution to the aspect of job security. What about frameworks, in my area they mostly want to see Spring and/or Struts in your CV.