I decided to do a mini-project by myself to help me understand a bit more about developing web applications before starting the new university semester. Using the Java SE and JEE/J2EE platforms. I will be creating a simple web application that will retrieve data from a database and display the data.

I decided to use a Model-View-Controller type pattern and so far decided that the:

Models: Will be Java objects which are persisted in the database using a framework. View: will only be the front end, probably written in HTML with some CSS.

I have not (at a high level) decided how the controller should be implemented, I initially went along with the idea that I will use JDBC to query results from the database and display it to the front end but the use of frameworks should ease the process.

I was told that there are some open source frame-works that help in making web application and a few I looked up were Spring and Hibernate.

My question then is there a way of incorporating these frameworks to what I proposed and if so how can I learn about these frameworks in order to create a web application?

Would appreciate advice and experiences about developing web-applications. This is something I have not done before so it’s all a new and a learning process for me.

In essence I want to create is a web-application using Java as the primary programming language in which database querying functionalities help in displaying outputs to the front end.

Edit: Edited question to make it clearer for those who want to start similar type projects.

  • 1
    How much experience do you have already with programming? Its hard to advise whats appropriate if we dont know that. – GrandmasterB Sep 7 '11 at 21:15
  • Well most of the programming I have done is in java and have been programming with it for almost a year and a half. I’m comfortable with OOP concepts such as inheritance, interface types and generics and can make extensive use of the Collections Framework. When it comes to the actual code implementation that won’t be a big issue. The issue for me is at the high design level and what kind of resources are there to help me achieve this? – BOWS Sep 7 '11 at 21:31
  • The models are definitely not "the data stored in the database". You may persist your models in the database via Hibernate, but the models are Java objects with your application's behavior. – kevin cline Sep 7 '11 at 23:15

I highly recommend picking up a copy of the JEE on Glassfish book and working through that. J2EE is the older Java Enterprise technology and should be avoided. Spring and Hibernate are wrappers around various JEE APIs and I'd recommend moving onto those technologies a little later once you've gone through the basics.

You can use JDBC to talk to the database, but the preferred JEE way (for simple CRUD applications) is to use JPA (which Hibernate is an implementation of).

| improve this answer | |
  • Excellent recommendation, got the book it's exactly the type of guide I was searching for!! – BOWS Sep 17 '11 at 17:43

I would say make a plain html website (a few pages, etc) with html5 and css. Make it pass html and css compliance.

Add some javascript to change some text to bold on the page.

Then add something simple like a page counter on a page.

Then add the page counter at the bottom of each page.

Add a form, with form values emailed to you.

Add a form with values entered displayed on screen (try to break it too by insertign html in the input values).

Scrap all that, then build a simple site in php.

Put a file uploader. Make the file save somewhere.

Put in a flash component (a video player is fun)

Put in a common header and footer in all pages.

scrap all that before you get carried away.

Go back to html5 and write an app with HTML5+css+javascript that consumes JSON that comes from a web service on your server.(see python nudge)

Scrap all that.

Write HTML5+css+javascript apps for iPhone, iPad, Android, with webservice interface.

Note that you can just bypass java and all the MVC stuff.

| improve this answer | |
  • He'll still have to write the web service to provide the JSON, and then do all the in-browser coding to render the content. While it sometimes makes sense to do this, it adds complexity. You end up with MVC on the server and in the browser. Not everything needs to expose a REST API. – Jason Lewis Sep 7 '11 at 21:26
  • This is great, but what if he wants to become a Java WebDev? – Jim Sep 7 '11 at 21:54
  • Yes as James mentioned I’m mostly interested in Java Web-dev. I’m focusing on key concepts to consider when creating a web-service in Java. – BOWS Sep 7 '11 at 22:12
  • I think you still need to go through my list. You can leave out the last 2 steps and jump into a java framework. – Christopher Mahan Sep 7 '11 at 23:19
  • I tend to agree with Christopher here. Its a good idea to get a basic understanding of whats going on between the browser and server first, and making some simple cgi style apps is a good way to do that. – GrandmasterB Sep 8 '11 at 4:05

The point of using a framework is that the framework developers have already implemented the functionality you're describing. Spring is probably the best-known Java Web Framework, so there's plenty of documentation and resources available to help you along.

The point of the Model part of MVC is that you don't have to write SQL by hand in most cases; you interact with model objects instead of querying directly.

You can get a brief overview and tutorial here: http://maestric.com/doc/java/spring/mvc

| improve this answer | |

I would recommend to use Play Framework, it's a modern Java (and Scala) web framework, that is easy to work with. It's inspired by Ruby on Rails and has a very short development cycle.

| improve this answer | |

I will have to suggest the Java EE 6 Tutorial. It will be better if you go or skim through all the parts but I think for your case the essential parts are Part I, II, V, VI and VII.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.