views:

183

answers:

6

Referencing my previous question about a good language for a deployment stack, we settled on Java / JSP. While with pure Java most of the team is up to par we have a few people who haven't done JSP Servlets, and none have used Struts to much extent. Where would you start with this? Would it be worthwhile to ditch Struts in favor of building something with straight JSP or does the benefit of Struts outweigh the time you would take to learn it? We would be using Struts 1.

I was told to look at Struts 1, and the Spring was anything but minimalistic. If I found something I could transition to from CI that would be great.

Personally I'm one of the people who is in need of this. I'm coming from a PHP background (straight PHP systems and using the CodeIgniter framework). It feels good to be back writing Java code, but I need some self direction on where to start exactly.

I've now looked at the following:

  • Struts 1
  • Wicket
  • Tapestry
  • Spring MVC
  • JSF

Things I've noticed that I'm not big on:

  • Beans (honestly never used them, what are they, why are they used so much?)
  • Lots of XML config files. I guess I could deal with this if I had to
  • Redeploying constantly to Tomcat. I'm new, I'm going to be redeploying almost every other minute. The one thing I liked about Wicket was the ability to run Jetty.

Of the ones I've tried I liked Wicket the best, but that's not saying much. I'm tagging on a bounty here. If someone coming from a CodeIgniter background has a framework that they thing is most like CI that would be preferred.

Update

It seems I was wrong about it being Struts 2, instead he meant Struts 1 but mixed them up. How you do that, I'm not sure.

I took a look at Play and actually felt very comfortable with it. However I'm still being told to look at Struts 1. Should I? What makes Struts 1 so great?

+3  A: 

Head to coreservlets.com.

You should above all ignore the JSP/Struts tutorials at roseindia.com. They only teaches bad practices.

With regard to the choice, as of now Struts is a pretty vintage framework (I assume you're talking about Struts 1.x since you didn't explicitly mention "Struts 2"). My personal recommendation would be to have a look at JSF 2.0 on Facelets instead of Struts on JSP. Coreservlets has JSF 2.0 tutorials as well:

See also:


Update: since you're actually talking about Struts 2: it's is a completely new and different framework which is taken over from WebWork. It isn't "just" an update. There is an extra abstraction layer between business layer and the Servlet API. You don't need to play/hassle with the "raw" Servlet API anymore. You can see it less or more as JSF without an UI abstraction layer. I don't know a better Struts2 tutorial than their own Developer's Guide (which I however personally find a bit opaque).


Update 2: as per your new questions:

Beans (honestly never used them, what are they, why are they used so much?)

They are perfectly suitable to function as model objects. Classes with encapsulated properties with public accessors and mutators which adheres a standard specification. There are a lot of (under-the-hoods) tools to manage them (transparently). Almost any MVC framework uses them to represent the model.

Lots of XML config files. I guess I could deal with this if I had to

Not if you take a framework which allows convention-over-configuration and/or annotations like JSF 2.0 (eventually on Java EE 6.0 for the extra cream on the topping). No XML configs are necessary for standard actions.

Redeploying constantly to Tomcat. I'm new, I'm going to be redeploying almost every other minute. The one thing I liked about Wicket was the ability to run Jetty.

Use a smart IDE with a good server plugin which can do hotdeployments on code save. Use the right tools for the job. Also try not to trial & error the code, but just write good code. It's not PHP.

BalusC
Whatever happened to Marty Hall? He used to speak at JavaOne, He was a good speaker and focused on web containers almost exclusively. I remember going to his Java University in 2002 I think and he made perfect sense. Then I went into the EJB 1.1 and 2.0 talks and was thoroughly confused and frightened.
Brian
Josh K
@Brian: not sure, I don't (can't) listen to conferences, but I've mail contact with him and he's all fine. He creates excellent tutorials at coreservlets.com. The JSF 2.0 one is relatively new. Just busy with own courses I think. @Josh: see my answer update.
BalusC
@Balus: What IDE would you recommend? I'm developing on OSX and tend to use TextMate / Terminal for 99% of my development work. I don't trial and error my code, but when I'm new at something it *will* inevitably happen.
Josh K
I use [Eclipse for Java EE](http://www.eclipse.org/downloads/moreinfo/jee.php). It has everything you need for Java EE web development. [Netbeans](http://netbeans.org) also seem to support it and seems to be good as well nowadays (at least, much better than when I tried it for first and last time ~8 years ago and immediately threw it away due to bad experience).
BalusC
@Balus: I'll give Eclipse a try.
Josh K
@Josh K: IntelliJ IDEA is another option. It has quite good Struts 2 support. There's both a free and a commercial version, the price tag is not that high and worth every penny imho.
rlovtang
@Balus: Ug, it appears I wasn't supposed to look at Struts 2, instead Struts 1.
Josh K
Well, Coreservlets.com has a Struts 1 tutorial.
BalusC
A: 

I always liked Ted Husted's approach to teaching Struts2 and Struts1. He has a project on Google code called Struts from square 1. It has all his materials (code, presentation slides, labs etc...)

http://code.google.com/p/sq1-struts2/

Brian
+1  A: 

Would it be worthwhile to ditch Struts in favor of building something with straight JSP or does the benefit of Struts outweigh the time you would take to learn it?

No, but it might be worthwhile to ditch Struts in favor of a more modern and powerful web framework, especially since you don't have any experience with it.

Struts was dominant 5 years ago, but has been overtaken in many ways by newer frameworks:

  • Java Server Faces has a lot of mindshare as an open standard with multiple implementations
  • The Play Framework is building a reputation for very lightweight development
  • JBoss Seam and Spring are higher-level frameworks with lots of powerful features
Michael Borgwardt
+1  A: 

When I read this thread, I see that some people don't know the difference about Struts and Struts2

Struts --> outdated

Struts2 --> A good choice for any Java Developers how like MVC Frameworks.

  • Play well with other Frameworks (There exists plugins for JSF/GWT/Spring)
  • Flexible in Configuration
  • Support for AJAX (There exist Dojo and jQuery Plugins)
  • Interceptors
  • ...

You can't compare Struts and Struts2.

jogep
A: 

Let's take these one at at time:

  1. Struts 2 - I wouldn't recommend Struts 1 or 2. It was the first web MVC framework, but others have learned lessons from it.
  2. Wicket - supposed to be nice and lightweight, but I haven't used it myself.
  3. Tapestry - good god, no. Only Howard Shipp still uses this heavyweight abomination.
  4. Spring MVC - I'd recommend this above all. Spring MVC is a fine web MVC framework, but the rest is what's valuable. It'll have a positive impact on your designs.
  5. JSF - another bloated abomination. A heavyweight component model built along the lines of Struts. Not recommended.

Better to think in terms of services and perhaps Flex or HTML 5. Decouple your back end from the UI and you'll stand a better chance.

duffymo
A: 

After using Struts for many years, both Struts 1 and Struts 2 (and WebWork, which in essence is Struts 2), I now use Grails for one project. Makes me want to convert my Struts 2 apps, Grails is so much more powerful and easy.

I have followed the Struts 2 dev mailing list for quite some time, and I'm not happy with the progress the latest 2 years. Looks like the momentum is gone. I recommend taking a look at Grails. If Groovy is not an option for you, I would consider Spring MVC over Struts 2. They are quite similar in type and complexity, but Spring MVC seems to continue to develop.

rlovtang