Home > Articles > Programming

  • Print
  • + Share This

J2EE

J2EE is near to my heart, so I'll talk about it next.

JSP and Servlets

I'll focus on open source servlet tools here, and you can assume that pretty much everything I say about servlets also applies to JSPs.

Servlets are one of the coolest technologies in the world. Using servlets, you can write HTML-based thin-client applications, safe in the knowledge that you only have to worry about the application itself. Of course, there's more you can do with servlets than simply write simple web apps, but that seems to be the most common use.

Most of us would agree that the most popular open source servlet container in the world is Tomcat, from the Apache Jakarta project. Apache Jakarta is very important in the eyes of the Java community because it has driven the servlet spec and the servlet container reference implementation for Sun.

NOTE

A cynic might say that Sun seems a bit envious of Jakarta and its control over servlets, and would like to take back control. A pragmatist would counter that Java probably would have faded into obscurity as a second-rate language were it not for the efforts of the Jakarta team in delivering an excellent technology that the whole industry rallied behind, and that Sun would have to be stupid not to recognize this fact—and Sun is far from stupid.

Tomcat is actually a bunch of closely related technologies:

  • Catalina—the servlet container itself

  • Jasper—the JSP translator (it translates JSP source into Java source for a servlet)

  • Coyote—a web server

The servlet specification and Tomcat are kept together in lockstep, so that when one is completed the other isn't far behind. The Jakarta web site already mentions Tomcat 5, the next big release that will include support for the latest and greatest servlet and JSP specifications.

The last year has seen very rapid development in Tomcat—which is odd given that it's already so far ahead of the rest of the industry. My favorite feature is the ANT tasks that allow hot redeployment of most of an application for testing, or cleaning up the mess after you've finished.

Struts

Of course, Tomcat only takes care of communications, security, and session details. You still have to write the application. Developers have known for years that one of the best ways to build end-user applications is to split the system logically into three parts:

  • Business model

  • Presentation of information to the user

  • Gathering feedback from the user, updating the model, and controlling the workflow

We call this pattern the Model View Controller (MVC). MVC contains tight feedback loops so that the GUI is always updated directly from the model whenever the model changes. This isn't practical in a web environment, but the other benefits of MVC remain even without it. To distinguish MVC with feedback from MVC without feedback, Sun called the latter MVC Model 2, or just Model2 for short.

Struts is an MVC framework into which you can fit your application. There are open source competitors for this task, but none of them focus purely on MVC, and therefore none of them are as simple as Struts.

Struts focuses on the controller part of the pattern. The model is too domain-specific to make many useful abstractions, and so is the view. You can write your view any way you want, but I believe that the most common strategy is to use JSP.

Enterprise Java Beans (EJB)

JBoss is possibly the largest piece of J2EE open source software in the world. It's around 55MB when unpacked—and that doesn't include the source (but it does include a special copy of Catalina). JBoss is possibly also the most popular application server in the world. It's certainly one of the world's most downloaded open source programs, with more than 200,000 downloads in a single month.

If you're not familiar with JBoss, you'll be able to tell by the name of this section that it has something to do with Enterprise Java Beans (EJBs). Unfortunately, we can't say that it's a J2EE application server. To aspire to that title, the software must pass Sun's certification process—something that JBoss may never do because the testing costs a small fortune, and JBoss, being free, generates no revenue to pay for the testing.

If you're doing anything with EJBs, it's a good idea to check out JBoss—it really is a very good product.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.