Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'ve been asking a lot of people where to start learning java web development,

ID: 651151 • Letter: I

Question

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

Explanation / Answer

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.