views:

122

answers:

7

Jsp or struts ?

In fact I'm even not so clear about the difference of the two framework, or is Jsp a framework at all?

A: 

They work together. But I would recommend to learn JSP first.

However, you can check out this Struts overview as well. It should give you the big picture.

thelost
What do you mean by they work together?
wamp
Struts and JSP and two technologies that can be used together. So one does not exclude the other. But learning JSP should take place prior to using Struts, IMO.
thelost
+1  A: 

There's also Spring MVC.

Noel M
A: 

have you considered Google Web Toolkit?

Schildmeijer
A: 

I recommend trying out Apache Tapestry.

It is easy to get started (read: lacks a lot of XML configuration), easy to refactor due to the templates being closely tied to POJOs and the fact that is based on sensible conventions yet allows you to change these is a definite plus.

The two biggest quarrels I have with it are that it has stringly-typed @Validate annotations and searching for "tapestry" sometimes brings up a lot of information about tapestries.

There is a good tutorial over at http://tapestry.apache.org/tapestry5/tutorial1/index.html.

ponzao
+1  A: 

Struts, Spring, Tapestry, etc. are MVC (Model-View-Controller) frameworks. JSP is just a presentation layer that is transformed to an HTML tags for display to browser.

Struts is the "grandfather" of MVC frameworks with huge followings. Struts2 is another. Spring is the now-generation of frameworks that includes Spring MVC for MVC as well as other goodies.

All these MVC's allows you to connect to a presentation layer such as JSP, HTML, FreeMarker, etc.

Hope this helps.

The Elite Gentleman
+1  A: 

Struts is a dead vintage framework. Don't you mean Struts 2? Anyway, there is no "best practice". Just choose whatever framework suits your needs. JSP is no framework, it's a view technology. Almost all frameworks are built on top of JSP/Servlet. Only JSF 2.0 doesn't by default use JSP, but its successor Facelets.

Related questions

BalusC
@BalusC, Struts is not yet dead, Apache are still developing it and it's still very much active.
The Elite Gentleman
A: 

If you're just starting out, I'd recommend avoiding the complexity of frameworks.

I started out by learning about web architecture from Martin Fowler's book Patterns of Enterprise Application Architecture. I recommend that more than anything; it will change the way you think and allow you to understand why certain frameworks are the way they are.

The best part of hand-coding using these patterns was that I was never fighting a weird corner-case of a framework's API, and I knew exactly what my entire codebase was doing.

The worst part is that you have to write a lot of CRUD data access code by hand, but this practice will make persistence frameworks like Hibernate MUCH more comprehensible.

A description of all the patterns are available for free online, as well as some excellent papers:

http://martinfowler.com/eaaCatalog/

The thing is, if you buy the book you'll get the complete picture. You can buy it for $30 US here:

http://www.abebooks.com/servlet/SearchResults?sts=t&tn=patterns+of+enterprise+application+architecture&x=0&y=0

One thing I don't remember if he covers is connection pooling/management or the particulars of JDBC. Just remember: ThreadLocal is your friend. It's a good way to use a JDBC connection (and any other request-scoped variables) for the life of a request without having to pass Connections around all the time. You can add pooling later.

And one other thing: JUnit + Apache HTTP Commons + XMLUnit are INDISPENSIBLE for testing. Make sure you run system tests! They will change how you code (for the better). You can assert the input/output of HTTP requests and their responses. Sometimes it's too high-level, but you'll learn when to test at a finer granularity.

brendan