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?
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?
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.
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.
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.
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.
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:
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.