What Is Tomcat?
Apache Tomcat — informally referred to as Tomcat — is an open source web server and servlet container which implements multiple Java EE specifications, including Java Server Pages (JSP).
Tomcat’s JSP engine is called Jasper. The current version is Jasper 2.0.
JSP was developed and released by Sun Microsystems in 1999.
It is not really a framework or a programming language. It is more like facilitating technology to assist in the development of dynamic Web pages on HTML, XML and other document systems.
JSP is similar to PHP, but as the name suggests, it is based on Java, a class-based, object-oriented programming language.
The latest official JSP release is 2.2 and Jasper 2.0 handles JSP 2.x versions.
Apache Tomcat has several major components:
- Catalina, the servlet container
- Coyote, the web server
- Jasper, the JSP engine
- Clustering, for load balancing across multiple servers
- High availability, scheduling upgrades without disrupting the running system
Tomcat, or an alternative web server with a servlet container, is used to deploy JSP (Java Server Pages).
Tomcat’s servlet container is dubbed Catalina. The connector component that supports the HTTP 1.1 is Coyote, which allows Catalina to act as a plain web server for local files and HTTP documents.
Because Tomcat JSP and support for such web apps is a niche feature, you will need a web host that specifically states that its servers capable of handling .war files and deploying web apps and websites built using such functionality.
Dynamic Web Apps With a Cup of Java
Tomcat provides management and configuration tools for developers, and it uses its JSP engine to create a pure Java environment in which Java code can run.
Tomcat and JSP offer developers the ability to generate dynamic Web content without having to install and use a full applet on the server.
This approach is geared to save time and money. Since Tomcat is developed and maintained by the Apache Software Foundation (makers of the popular web server), it is open-source and you can use it free of charge under Apache License 2.0.
Since 1999, Tomcat has gone through a number of major releases and the current stable version is 8.0.15. However, 7.0.x releases are still widely used.
Tomcat Software and Hardware Requirements
Tomcat 7.x requires that your server have Java version 1.6 (or later) to run properly, unlike older releases that used Java 1.1 through 1.5. Tomcat 7.x also implements Java Servlet 3.0 and JSP 2.2 specifications.
The requirements actually have more to do with Oracle than Apache, since most of them revolve around Java support.
This means Java requirements for your server are the ones to look out for, but they vary depending on the version of Java and Tomcat you intend to use.
As always, you will want to check with Oracle for the latest updates in terms of what you need to run your apps.
Tomcat 6.0.x vs. 8.0.x Requirements
|6.0.x||Servlet 2.5||JSP 2.3|
|8.0.x||Servlet 3.1||JSP 2.3|
For example, Tomcat version 6.0.x requires Servlet 2.5 and JSP 2.1, while Tomcat 8.0.x uses Servlet 3.1 and JSP 2.3.
Upcoming Tomcat 9.0.x releases will be compatible with Servlet 4.0 and possibly JSP 2.4.
Tomcat Hosting Factors
Finding the right kind of hosting ultimately boils down to finding a host that can accommodate Java overall and allows you the option of spinning up JSP and Tomcat. This will mean at least a couple of things.
Tomcat and cPanel
Check to see whether the host offers cPanel for server management, and ensure the module is integrated into it.
This will allow for JSP and servlet functionality to be enabled. You should also be able to deploy JSP and servlets via the cPanel.
This is usually a given for cPanel, but it’s always a good idea to confirm the function before making a purchase and opening an account.
Additionally, cPanels tend to be standard offerings with shared plans — users of VPS plans or dedicated servers might need to pay extra for a cPanel if they do not have the skill necessary to manage their environments using the command line.
Living Dangerously With The Latest Tomcat Releases
If you intend to use the latest available Tomcat releases, or even use unstable releases for testing and early stage development, you will need a host with a good track record of deploying the latest Java/JVM updates to its servers.
Consider A VPS For Demanding Applications
If you intend to run a resource-intensive application and you would like to maximize the resources allocated to your app (or prevent the cannibalization of your resources by websites with which you share a server), consider opting for a host that offers you a dedicated server instance or private JVM.
Take a look at the software versions supported by your web host provider.
For example, one host that we looked at provided explicit specifications on which Tomcat and JDK versions you can run on their servers.
Tomcat: A Niche Market . . .
Although solid Java support is the most obvious prerequisite for Tomcat JSP hosting, you need to bear in mind that Tomcat hosting remains a relatively tight niche.
As we have mentioned, we have found hosts that specify requirements for Java and Tomcat.
The Bad News: Not A Lot Of Tomcat-Specific Plans
Tomcat is not a big money maker for big hosting companies, so they focus most of their effort on more marketable plans, such as those geared toward the millions of WordPress users.
. . . But there are Tomcat-friendly Hosts
Many big hosts lack specific Tomcat hosting plans, but at the same time this also means that there are some smaller outfits out there that see an opportunity in catering to the Tomcat community.
These plans provide you with servers that include Tomcat out of the box, saving time and effort.
Lots of Plans for Tomcat
These hosts usually offer starter packages at symbolic prices offering unlimited resources (such as disk space and file transfer), while more serious (and useful) plans come in a wide range of prices.
This is understandable because Tomcat is extremely scalable, hence prices range from just a couple of dollars a month for entry-level VPS plans to pricey high-bandwidth plans with 4GB of RAM, ample SSD storage, and powerful eight-core Xeon processors.
Prices for these high-end plans can easily end up in triple-digit territory.
Summary: There Are Still Tomcat Hosting Deals To Be Had
The fact that many mainstream hosting companies don’t tend to be involved in the Tomcat niche does not mean there are no good alternatives.
On the contrary, a number of small companies specialize in this space and get good user ratings, so there is nothing to worry about.
There are several questions you should ask yourself before you commit to a plan:
- How much will the plan cost?
- Do you need a VPS?
- Will the contract be yearly or month-by-month?
- Are the staff knowledgeable about Tomcat?
- What options do you have for support?
The fact that you are using Tomcat JSP and in need of Java web hosting narrows down your options considerably. However, there is still more than one option available.
So which Tomcat host is the one that’s best for you? Here are some great options for you to consider.
My Choices: The Top Three Apache Tomcat Hosts
As we mentioned previously, looking for a web hosting provider that supports Tomcat JSP (and by extension, Java) narrows down your options considerably.
For example, GoDaddy, one of the more popular providers of web hosting services, removed support for all Java-based apps in their shared plans. So if your budget only allows for a shared plan, GoDaddy is not a viable option for you.
With that said, here are three great options we think you should look into seriously:
HostGator will install Tomcat free of charge on Linux-based VPS plans or a dedicated server.
However, if your account includes a cPanel control panel, you can install Tomcat by yourself at no additional charge.
Regardless of which option you choose, Tomcat is an add-on to your server’s operating system and you will need to work with the HostGator support team to get everything up and running. HostGator is one of the better hosts for JVM.
Though A2 Hosting does not offer explicitly Java hosting, the company is nevertheless an all-around solid provider of web hosting.
Generally speaking, if you are looking for web hosting (especially shared hosting) the supports niche features, you can’t go wrong with A2.
The company strives to be as developer-friendly as possible, so if they do not currently support something you need, you are welcome to submit a feature request for inclusion in the company’s development queue (though we do note that the company already supports JVM).
Furthermore, the company is one of the few that offers managed Virtual Private Servers (VPS) and dedicated hosting options.
JavaPipe is a provider of cloud-based hosting for Java and PHP-based websites. They offer industry-leading protection against cyber threats for all of its users, and they are one of the few providers that offer you several options when it comes to hosting for Tomcat web apps.
We also want to mention the availability of cloud-based, developer-oriented hosting from internet giants such as Google, Microsoft, and Amazon.
These options tend to be supremely scalable and infinitely flexible and therefore make a good fit for such niche hosting needs.
Pros and cons of Tomcat
- Tomcat is extremely lightweight, so if you are already working in a Java-based environment and you need something to help you serve up dynamic web pages, Tomcat is a good option
- Tomcat is open source and therefore free to use
- Because Tomcat hosting is such a niche product, your options are relatively limited. You have fewer options, and you may end up paying more to support such technologies than if you chose a more popular and commonly-used option.
Recommended Reading and Resources about Apache Tomcat
This is the official site for Tomcat. Here you’ll find extensive documentation, FAQ, training opportunities, build bots and much more.
Helpful tools for getting started with Tomcat plus plenty of how-tos and tutorials.
An interesting glimpse into corporate and project-based uses of Tomcat.
Other features in Web Servers
Tomcat JSP Frequently Asked Questions
- What is JSP?
JSP stands for JavaServer Pages.
- What is a JavaServer Page?
A JavaServer Page, or JSP, is a technology that allows developers to build dynamically generated HTML, XML, or other text based files formats using the Java language.
- How does a developer use JavaServer Pages?
JavaServer Pages files allow a developer to write static content (such as HTML) and then include dynamic content (variables, functions — Java code) into the file.
JSP is very similar to the way PHP or ERB (Embedded Ruby) allows dynamic code to be embedded into a text file.
- What language is JSP code written in?
- Who developed JavaServer Pages?
JSP was originally developed by Sun Microsystems, and released in 1999. It is currently owned by Oracle.
- What operating systems can JavaServer Pages be run on?
Because JSP is a Java technology, JSP can be run on any OS that supports a Java Virtual Machine. JVMs exist for almost every operating system and platform available, so JSP can be used almost anywhere.
- What software is needed to run a JSP-based app?
Besides a Java Virtual Machine, deploying and running JavaServer Pages requires a compatible web server with a servlet container, such as Apache Tomcat or Jetty.
- How is JSP created?
JSP is a high level abstraction Java servlet. When a JSP app is run, each JSP page is converted into a servlet which is then cached and reused until the original JSP file is modified.
- Is JSP compatible with MVC or other type of architecture?
Yes. JavaServer Pages can be used as a standalone tool for a small dynamic web site or app, or as the view component in a larger MVC (or other) architecture.
Typically, when used in an MVC environment, the Model is built using JavaBeans while the Controller is built using Java servlets or a framework such as JavaServer Faces or Apache Struts.
- What is the standard output of a JSP files?
JSP files are compiled at run time into Java servelts. When a web server receives a request for the .jsp file, the servlet returns a document. Typically, this is an HTML document, but in theory any document type could be returned.
- What is the benefit of JavaServer Pages?
Any programming language can write output to an HTML document or other format for web consumption.
Certainly, Java was capable of doing this long before JSP was deveoped. JSP, though, makes it easier to output templated documents that only need a fraction of their content to be dynamic.
Rather than line after line of print commands, and having to worry about character escapes and reserved words, JSP allows developers to write documents in the output language.
- Can markup (or other output text) be included in programming blocks?
Yes. Programming blocks can be split across blocks of markup. The output text inside the block is determined by that block.
For example, markup text appearing within an IF statement will only be output if the conditional is TRUE. Similarly, markup can be included within loops and any other programming constructs.
- Can JSP be used with the Unified Expression Language?
Yes. Data and functions from Java objects can be easily accessed from within JavaServer Pages servlets via the usual UEL syntax. This makes JSP highly compatible with JavaServer Faces, which also uses UEL.
- Can JSP be extended with custom tags and libraries?
Yes. In addition to the tags created by JSP itself, developers can create libraries of custom tags to add functionality to JSP.
Additionally, there is a standard library for JSP, called JSTL (JSP Standard Tag Library) which provides JSP tags for common tasks, such as XML data processing, conditional execution, database access, loops, and internationalization.
- Are JSP pages compiled?
- Can JSP files be modified during run time?
Yes. Most JSP containers can be configured to periodically check the .jsp source files and recompile the servlet if changes are found.
The recompile time is typically set very low (seconds) during development, and then increased or turned off altogether for deployed, production code.
- What are the major alternatives to JavaServer Pages?
JSP is the primary templating language for Java, but others exist. Most prominently the Tea templating language, which is open-source.
Moving away from Java, there are several other technologies that provide the same benefits. JSP was largely responsible for moving developers off the earlier (and now defunct) ASP technology.
PHP was designed to work like JSP, and is now a complete programming language in its own right. Embedded Ruby provides a templating language similar to JSP.