views:

364

answers:

2

I'm finding it difficult to embrace a Java MVC framework, when it looks as if Servlets, JSPs and a lightweight DAO will do just about everything you need it to do in order to decouple the controllers/views/models. For PHP I can see the necessity since there are no built in constructs like servlets, but do Java MVC frameworks really give you THAT much more?

+4  A: 

One area where Servlets/JSPs are somewhat weak is testability. Although it's certainly possible to unit test Servlets using mocks, they don't feel like they were designed with unit testing in mind. JSPs are even trickier. You could rely on functional tests ala Selenium, but these days, people want unit test coverage. Some of the more modern Java MVC frameworks give you more easily testable code units.

On the whole though, you're certainly correct that a plain old Tomcat stack with a MySQL database gets the job done.

Asaph
+2  A: 

Most web frameworks abstract away the low level details. For example, Wicket, Tapestry and JavaServer Faces allow you to think in terms of components (e.g., buttons, labels, drop-down list, etc) instead of http protocols. Even action-oriented web frameworks like Spring MVC and Struts bring you a level higher than the underlying technologies used.

As an added bonus, these frameworks come with additional capabilities, such as Ajax, Comet, integration with persistence frameworks, which works out of the box.

Of course, as Asaph has pointed out, web frameworks are usually easier to test.

shaolang