Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've been asking a lot of people where to start learning java web development, I already know core java (Threading,Generics,Collections, a little experience with (JDBC)) but I do not know JSPs and servlets. I did my fair share of development with several web based applications using PHP for server-side and HTML,CSS,Javascript,HTML5 for client side.

Most people that I asked told me to jump right ahead to Hibernate while some told me that I do not need to learn servlets and jsps and I should immediately study the Spring framework. Is this true? do I not need to learn servlets and JSPs to learn hibernate or Spring?

All of their answers confused me and now I am completely lost what to learn or study. I feel that if I skipped learning JSP and servlets I would missed a lot of important concepts that will surely help me in the future.

So the question, do I need to have foundation/know servlets and JSP to learn spring or hibernate or any other java web frameworks.?

share|improve this question
3  
Note that hibernate is just a database abstraction layer, nothing more, and it can be used to plug a data source into any kind of java app, not just a web application. –  Ed Griebel Sep 7 '12 at 0:10
1  
Knowing about servlets and JSP wouldn't hurt, have a look at "Head First - Servlets and JSP". An easy to understand read, but also covers a lot. –  Jaydee Sep 20 '12 at 11:38
    
@Jaydee I am currently heading Core Servlets and JSP by Marty Hall + Murach 's servlets and JSP. –  KyelJmD Sep 20 '12 at 12:07
    
I don't think this question has been answered adequately. Bear Bibeault, a well known developer and authors insists that one learn JSP and Servlets before learning ANY framework. Anyone care to show why that may or may not be applicable today ? Here is his post - coderanch.com/t/521300/JSP/java/JSP-servlets-struts –  Borat Sagdiyev May 11 at 1:02
    
Okay, I got some answers from Bear Bibeault. See these two links - coderanch.com/t/633527/Spring/… and coderanch.com/t/633526/JSP/java/… –  Borat Sagdiyev May 11 at 4:18

4 Answers 4

up vote 4 down vote accepted

If you've got a good grasp of HTML, CSS, and JavaScript, you have a leg up on many people who end up doing web development. The concepts behind JSP are very similar to PHP. The quirks are different. A servlet is the name for a chunk of Java code that serves a request. That's it really. The whole original Struts framework was a single servlet.

I would add Tomcat to your list of technologies to learn. It's the original Java Servlet Container implementation and happens to also be a fully featured and rather popular web server. GlassFish is built on top of it. You can make a little web site with Tomcat and JSP (tutorial here or JSF) knowing just what you know and spending a few hours going through tutorials. That way you can start where you are comfortable before stretching out. Then make a javax.servlet.http.HttpServlet that writes "<html><head><title>Hi</title></head><body><h1>Hello World</h1></body></html>" to the response object, list it in your Tomcat web.xml and send an HTTP request it from a web browser. It's not rocket science. All Java web frameworks are variations on those two basic activities.

Keep in mind that the strength of Java for web applications is its reliability, maintainability, and performance. For the simple little site, PHP or Ruby/Rails is simpler, but Java will scale as much as you want to go. I am not bowled over by any of the Java web frameworks. When you have a team of people working on a large web application, then a framework like Spring really shines. Spring is the most popular. When you have some familiarity with servlets and JSP/JSF, then learn how Spring ties those together with a data model.

If you are making a blog or a content management system, maybe you can get away with a NoSQL "database." But I would make the case that NoSQL "databases" are replacing the file system, rather than replacing traditional databases.

Contrary to what others have said, I think that JPA (Java Persistence API) which is based on Hibernate is a critical part of any large web application. Hibernate/JPA is tricky and weird, but eventually worth the struggle. I would recommend you get a basic familiarity with SQL and JDBC (Java Database Connectivity) before you tackle Hibernate/JPA. After you are comfortable with the world of Java objects, and the world of relational databases and SQL, then you can learn JPA/Hibernate/ORM (Object to Relational Mapping) which connects the object world to the relational world.

I learned Hibernate with the printed book Hibernate In Action. This is a very helpful book, but difficult because each detail must be understood. There is a newer book Java Persistence with Hibernate. The people who made Hibernate are brilliant and it is a great tool. JPA is actually based on it, though Hibernate also implements JPA.

Though I only know Hibernate, I recommend you start with the JPA that ships with Java EE 5 and later (which is completely usable with Java SE 5 or later - just add the necessary JAR files to your project). The people making JPA had the advantage that Hibernate had gone before, and people had struggled with explaining Hibernate before, so the JPA folks were sowing in previously plowed fields. If you need a feature or performance that JPA does not have, then switch to Hibernate, which may have a few extra bells/whistles. At least you'll understand all the concepts that way before getting bogged down in Hibernate's details.

You have some of the most important skills already. Take the others one at a time and try not to get overwhelmed.

share|improve this answer
    
do you have any links or tutorial where I can start learning the said technologies? or perhaps a good suggestion for a book. Most applications that I made uses a RDBMS, from SQL Server to a simple MySQl. –  KyelJmD Sep 7 '12 at 3:38
    
I cleaned up my answer and added links as requested. Hibernate/JPA and the various web frameworks take time to learn and master. Most of the other technologies, you know enough about already that you should be able to have working in a few hours or a day. I don't know Spring, but check the documentation on their web site or get a highly rated book on Amazon. –  GlenPeterson Sep 7 '12 at 13:27
    
I don't see how this answers the question. Bear Bibeault, a well known developer and authors insists that one learn JSP and Servlets before learning ANY framework. Care to show why that may or may not be applicable today ? Here is his post - coderanch.com/t/521300/JSP/java/JSP-servlets-struts –  Borat Sagdiyev May 11 at 1:02

I would suggest learning about basic JSP and Servlets as it will help you grasp the concepts that are simplified in Spring. Since you have experience with PHP-based CGIs, most of JSP/Servlets will just different ways of doing things you are familiar with so it should go fairly quickly. The hardest thing you may find will be picking up the unique idioms in the java world.

As far as Hibernate goes, I'll agree with MebAlone and say learn it if you need to, but if it's already set up you can do 90% of what you'll need to by just cribbing what others have done.

share|improve this answer

Short answer: no, you don't need to learn Servlets and JSPs as a pre-requisite for Spring MVC and many other Java web frameworks.

Let's get Hibernate out of the picture first. It's a persistence layer framework and it doesn't have anything to do with Servlets and JSPs.

Servlet API is the lowest level for almost all Java web frameworks. Even JSPs are compiled to servlets.

Spring MVC is a layer on top of Servlet API with lots of helpful extensions and integration with Spring Core. You can use JSPs as a rendering mechanism for Spring MVC. Spring MVC tutorial will take you all the way from the ground up to create web apps. As you go along you will learn about JSPs, and you will be well equipped to understand Servlet API as well.

share|improve this answer
    
what book or video tutorial would you suggest to learn Spring MVC? –  KyelJmD Sep 7 '12 at 0:44
2  
    
@YuriyZubarev - I don't see how this answers the question. Bear Bibeault, a well known developer and authors insists that one learn JSP and Servlets before learning ANY framework. Care to show why that may or may not be applicable today ? Here is his post - coderanch.com/t/521300/JSP/java/JSP-servlets-struts –  Borat Sagdiyev May 11 at 1:02

It sounds like you want to learn server side web development with java. There are a number of frameworks. Spring MVC is in fact the most popular, it is mature, very full-featured, and a good framework to know. Spring MVC and other java web frameworks abstract the java servlet API from the programmer - so technically you don't need to know it. But I would suggest learning the basics - particularly the key classes. A day of study should get you there.

As for JSP, if you know PHP you already understand the essentials. JSP is java's version of server-side scripting.

Hibernate is an implementation (the most popular) of JPA, which is the java spec for persisting objects to RDBMS. With the explosion in popularity of NOSQL db's (Hadoop, Mongo, etc), Hibernate is much less of a 'must know' than it was even 18 months ago. Personally I learn storage technologies on a need-to-know basis because there's a lot of them, and you lose what you don't use.

share|improve this answer
    
What book could you suggest for Spring MVC? what is the difference bet Spring and Spring MVC? –  KyelJmD Sep 7 '12 at 0:27
    
Spring is a java technology stack that includes a wide variety of projects. Spring MVC is the server side web framework. Spring's online documentation and sample applications are the best way to learn Spring MVC. –  MebAlone Sep 7 '12 at 4:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.