Why should I learn and use struts?

David Parks picture David Parks · Oct 11, 2010 · Viewed 21.5k times · Source

I'm a java developer, not seasoned, but I am familiar with most concepts reasonably well.

I recently built a website using Tomcat/JSP (~30 dynamic pages). I made the newbie mistake of including large sections of core logic in the JSP, using the rationalization that it's "just a simple project".

I learned the hard way. So I'm re-building the app now in google app engine using servlets and planning to use Velocity to implement it using a Model-View-Controller design pattern.

I'm also looking at Struts, but haven't used the framework before.

Can someone convince me why I should incorporate struts into this project? Is it really going to buy me a lot for a medium sized project of one or two people?

There is a clear cost in an extra learning curve with strut, will the benefits outweigh the costs? Or will the use of Velocity be enough to segregate the logic? Opinions?

Answer

Brian picture Brian · Oct 11, 2010

I would look longer term than this project. As you saw, first time you use any technology is largely about making mistakes and learning from them. So this first project won't likely be a shining example of Struts usage once you're done.

Using Struts (and Tiles from what you indicate was a main concern: JSP copy and paste) will however be an excellent delve into "proper" MVC, i.e. it forces you to do things in a particularly structured way, and one which I happened to appreciate a lot, I was a big Struts fan.

That said, there are other options, e.g. Spring contains Spring MVC plus much much more. If you're going to invest in overcoming a learning curve, think about which framework will most benefit you overall in the medium term: which frameworks do employers in your area tend to look for, for example? At this point in time, I would go with Spring where I feel the momentum is but Struts is very good at what it does.