8

I'm trying to learn Java EE, starting with Servlets and JSPs in an MVC architecture. I know Servlets are often used as the controller and JSPs are often used as the view, and that these both interact with the model, the back end java application on the server. The question I'm asking is what the back end application would consist of. Is it nothing more than a simple JSE application that uses Servlets and JSPs as the interface?

Also, considering I'm asking what's probably a simple question, is there a good Java EE MVC tutorial I could use?

bdoughan
  • 147,609
  • 23
  • 300
  • 400
Voxl
  • 111
  • 1
  • 1
  • 5

3 Answers3

10

The Java EE components all run on the server side, either on full Java EE servers like GlassFish, JBoss, WebLogic, or WebSphere, or on servers like Tomcat that just support servlets and JSPs.

In Java EE the MVC model can be thought of as a "domain model", ie the Java objects representing the entities that are important to your application. For instance a shopping application would have domain objects representing items for purchase, shopping carts, credit cards, mailing addresses, accounts, reviews, and so forth. Often these domain objects come from persistent storage such as a relational database.

Java EE's Java Persistence API is designed to handle the mapping between the Java domain model objects and the relational database tables used to make the objects persistence. Hibernate is one implementation of a JPA "object-relational mapper" (ORM).

Java EE is much more than that. To take just one example, it defines an ultra-reliable messaging service (Java Message Service) that back end application components use to communicate with each other.

As you explore Java EE, do give some thought to simpler and more productive alternatives like Ruby-on-Rails, LAMP stacks, Microsoft's .NET platform, and "light-weight" Java approaches like Spring/Hibernate. Richard Monson-Haefel, who wrote O'Reilly's very successful "Enterprise JavaBeans 3.0" (the fifth edition) and "Java Message Service", even goes so far as to claim that Java EE is "intimidating" to developers and will be eclipsed by these other approaches.

A good place to get a wider perspective is Todd Hoff's wonderful blog at http://highscalability.com/

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Jim Ferrans
  • 30,582
  • 12
  • 56
  • 83
2

Similar question has been asked on SO, i think.

Here's a good tutorial to get you started.

http://courses.coreservlets.com/Course-Materials/csajsp2.html

krishna
  • 1,366
  • 2
  • 15
  • 23
2
  1. To do java web programming, servlet is not a must. You can simply use jsp, like the way people program php & asp. It's fairly straight forward, and get u started easily. This is called Model 1 method.
  2. For Model 2 programming model, if you really want to do MVC programming, you can study "Page Controller" and "Front Controller" design patters to understand how they work behind the scene.

    If you want to use ready-made framework, you can try out Spring MVC.

http://www.vaannila.com/spring/spring-mvc-tutorial-1.html

good luck.

janetsmith
  • 8,562
  • 11
  • 58
  • 76
  • Straightforward JSP pages without servlets & beans is ugly and should never be used, except maybe when quickly prototyping a feature, before its actual development. I would downvote this answer, if I could. – Med Dec 08 '12 at 07:42
  • 2
    The would be no ultimate right or wrong answer. It's all depends on the requirements, time-frame, and purpose. I sick of people keep saying "we much use this technologies or to do, because it is the *right* way, without considering the criteria". The reason why I propose JSP at first was because thinking it can help him get started easily, and proceed to servlet MVC when he feels great. He can even try SpringMVC or EJB3 after that. – janetsmith Dec 08 '12 at 18:07
  • When asking about Java EE MVC, we have to recommend Spring MVC, still Spring is not Java EE. This is a sad story. Java EE is not having a proper MVC (action based) framework, we hope to have it in Java EE 8. – siva636 Jun 12 '14 at 09:47
  • Start from JSP is great! JSP/PHP/ASP have a function that you can write completely back-coded page,no signle line of html/js/css, a file all surround with <%%> 。The difference of jsp is that in this situation, you can write a servlet instead of jsp, but PHP/ASP they can't write such solely-backed file, they just use <%%> to simulate a backed file. – gfan Oct 30 '16 at 10:19