| By Brian Russell | Article Rating: |
|
| July 18, 2005 01:00 PM EDT | Reads: |
33,521 |
There comes a time, for many Web sites, when the transition from static HTML to dynamic HTML has to be made. Whether it's a static company Web site that needs to become a dynamic online store, or a simple collection of family pictures that's become too large to manage with HTML alone, a decision has to be made to move to an environment that makes it easier to build and maintain the site. Deciding to use server-side programming to create your site on-the-fly can become the only option, but what language you decide to use can be a difficult and important decision.
Server-Side Options
Server-side programming options are plentiful. Each offers its own pros and cons, and each promises to be the best choice. Examples of languages used for dynamic Web site development include Perl, PHP, ASP (and .NET), ColdFusion, and Java. Factors, such as cost, can quickly drive you to one language. The cost could be in software licensing, server usage, or server management. Some of the options, like Perl and PHP, are distributed freely, which can have quite an influence over someone looking to step into the dynamic world. These two are also commonly found on most Web servers, further increasing their appeal. Java, which is also freely available, is also found on many servers. If you're just starting to get into dynamic Web site development, it's unlikely you'd have your own server and would rent or lease it from a hosting service provider instead. A quick Google search will show you that the number of hosting companies is amazingly high. What you'll also find, after checking out some of those companies, is that Web servers running Perl/PHP usually cost less then Java ones.
Java on the Server
The use of Java as a server-side programming language has increased during the past few years. The way Java is used has also changed dramatically. Applications are commonly written to use the most powerful and robust architectures available. From EJB-driven database access to XML based extraction, everything new and exciting in Java requires more configuration and coding. User interface architectures are also everywhere, allowing easy integration of the complex backend processing in Web page development. To an outsider, or someone new to Web development, Web applications written in Java can appear to be bloated, unmanageable, and a headache to be avoided. Most of what you read about Java is based on new technologies. Someone entering this world can be easily overwhelmed with all of the APIs, configuration options, and complexity that the Java community seems to embrace. This leads the new programmer away from Java and into the other options available like PHP.
Java Server Pages
Java Server Pages (JSP), like other scripting languages, contains a combination of HTML and code to be interpreted and executed by the server. In the case of JSP, the code is written in the Java programming language. JSP can also contain special tags that appear to be HTML but are really references to additional Java code to be executed by the server. These are known as tag libraries. Before JSP existed, Java servlets were used to write out HTML to the Web browser. This made it difficult to make simple changes to a page because the servlets contain many print statements to output the HTML code. Making changes to the servlets also required that they be compiled before getting deployed to the application server. JSP simplified this process by letting the developer work with a simple text document. The application server takes this document and generates and compiles a servlet. This is an important difference between Java and the other Web languages. Java code is compiled, while PHP, for example, is not.
Does this mean Java is faster than the other languages? The simple answer is yes, but the reality is that there are many factors that play to what makes one system faster than another. The way the code is written can have a major impact on the performance of the application. Other factors, like server performance, database performance, and other external bottlenecks are also influential.
Editors and IDEs
When working with JSP, you can use any kind of editor you like. Most Web developers wouldn't think twice about using a simple text editor to edit HTML or other languages like PHP or Perl, but when people think of Java they often think of an integrated development environment (IDE) like Eclipse, Sun's JavaStudio Creator, IBM's Rational Application Developer for WebSphere or BEA's WebLogic Workshop. If you're going to be developing a full-blown J2EE Web application, then an IDE would be the way to go. If you are just doing JSP development, then you can choose something simpler. It's often easier to use an IDE designed for the language you're working with because the IDE can add important development tools, such as code assistance or syntax checking. Although these features are desirable, they're not necessary. In the end, JSP developed in an IDE works the same as the code written in VI. Relying less on the tool can also help you be a better programmer because you'll learn from your mistakes instead of just having them corrected for you.
Web Architectures
The architecture of a system can determine how robust it will be. The architecture also determines how complicated it will be. For many people, Java application development brings to mind a three-tier architecture that separates the display logic, business logic, and data retrieval. The Model-View-Controller (MVC) architecture is a common example. A typical MVC design would include JSP for providing the user interface (view) to the client, and servlets (controllers) working between the JSP and the persistence layer (EJB, Hibernate, etc.) for data access (model) and application flow.
An MVC architecture is an ideal paradigm for larger enterprise applications. It lets different types of developers work on a system's components independently. It also provides much better scalability and maintainability, but it does introduce more overhead that can slow performance when compared to a simple two-tier architecture.
The two-tier architecture is, very simply, the code and the database. The code is a combination of display logic and business logic. Some people may argue that the Web browser is a third tier. The important point here is that the presentation and business layers be combined into one.
If you're just going to be working on a site for yourself for personal use, or even business use, the multi-tier architecture is more work than needed to handle the site. A two-tier architecture is commonly used in other languages and it can be easily implemented in JSP development. When evaluating the Web programming language options, Java is often thought of for large-scale sites while other languages like PHP are thought to be for smaller sites. JSP development can be done as quickly and easily as the others, often with better results.
Keeping It Simple
There's a time and place for every type of architecture. If that weren't true, we wouldn't have all of these architecture options available to us today.
The two-tier architecture is an excellent choice when putting together a family Web site, a personal hobby site, or even a small business site. In situations where one person is solely responsible for a site, it can be easier to build a site with just JSP. Even if there are a couple of people who will work on the site, it can still be done if they all have similar capabilities. With this architecture, the JSP contains all of the display logic, business logic, and database retrieval code. Anyone working on the site would need to understand all aspects of Web development.
Suggesting this type of development can be a source of argument. Many software engineers strive to develop applications using just the multi-tier paradigm. They argue that it offers easier development because components are separated, which also promotes component ownership and specialization in the developers. Componentized design also promotes reuse. It can also be argued that multi-tier architecture provides better scalability and maintainability. These are valid points, but there are opposing arguments to be made.
Published July 18, 2005 Reads 33,521
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Brian Russell
Brian A. Russell is a Java developer for Telvent DTN in Omaha, Nebraska.
![]() |
Infernoz 09/03/05 03:34:19 AM EDT | |||
You have got to be kidding about embedded Java code and lots of Smart Tags in JSP pages (Model 1), Informix Web DataBlade showed me the incredible stupidity of this approach i.e. massive pages, nasty error trapping and logging code, and appalling maintenance costs, so don't do it, however tempting, you will regret it! If you use JSP, use at least Model 2 JSP and consider using higher level engines for larger sites e.g. Java Faces, Velocity etc. |
||||
![]() |
Infernoz 09/03/05 03:33:47 AM EDT | |||
You have got to be kidding about embedded Java code and lots of Smart Tags in JSP pages (Model 1), Informix Web DataBlade showed me the incredible stupidity of this approach i.e. massive pages, nasty error trapping and logging code, and appalling maintenance costs, so don't do it, however tempting, you will regret it! If you use JSP, use at least Model 2 JSP and consider using higher level engines for larger sites e.g. Java Faces, Velocity etc. |
||||
![]() |
maxmath 08/09/05 03:45:39 AM EDT | |||
I agree with a lot of points with the author. JSP is a good language to develop small and simple application. It's a pity that it is no more supported by Sun and the developper community. |
||||
![]() |
George Jempty 08/02/05 06:52:22 AM EDT | |||
Plain JSPs, with business, data access, and view logic rolled into one, should never be used for anything but the quickest and dirtiest prototype: |
||||
![]() |
Dev Null 07/26/05 10:54:55 AM EDT | |||
One thing you failed to mention when using JSP is the need for an application server. PHP on the other hand uses just the HTTP Server on a system with PHP installed. I have been a J2EE architect and developer for many years and recently when trying to get something professionally looking up and running, it is easier to forget about the app server and use something like PHP. Just my 2 cents. |
||||
![]() |
Don Babcock 07/22/05 08:54:35 AM EDT | |||
Good article. It's worth noting that there is another free solution out there that marries the best of Java and the simplicity of tag based languages. While ColdFusion CF is Java under the covers, New Atlanta makes a competing product (Blue Dragon) that follows the CF language model (tag based) and for which the low end version is free. That version has about 80 plus percent of the features and certainly all that is needed if what is in view is moving from a site that is HTML to dynamic content. It is available in both Windows and Linux incarnations and is quite powerful. The major cost of a web site over time is maintenance and CF is a very "friendly" alternative to JSP. It can be readily understood by those coming primarily from HTML as it uses the same tag paradigm. Like ColdFusion, it uses Java as the core engine so it can easily be extended to incoroporate in Java anything needed that doesn't come natively. It's worth a look if you are looking at low cost (free is hard to beat.) I've ported a lot of code between commercial CF which we use at work and Blue Dragon which I use on my own sites with complete portability. The Macromedia folks are always upping the ante by adding new things but CF has been around for so long that the core things used to build dynamic sites are commodity features share by both products and very nearly identical in function. About the only thing required is adjustments in the SQL if you use a different underlying DB but that's true everywhere. |
||||
![]() |
digereedoo 07/22/05 02:35:33 AM EDT | |||
Unfortunately, I disagree with the whole choose a programming language theme. There is only one programming language left and thats Java. But more than that, patterns like MVC and the complexity they foist on these "regular" programming languages are telling us something. WHAT? Are they telling us? They are telling us that our programming languages are HORRIBLE at implementing real solutions. They are great at HELLO WORLD, pounding expressions endlessly in loops and the FAKE bank account example. But we have a really, really hard time delivering solid stuff with them. So why is that? If these patterns are so indispensable then maybe the patterns have evolved further than the languages that we program in, because if it was that clear I would be programming in MVC not Java. But alas, its not. We are using the wrong hammer no matter what we do these days and we just try to make things "maintainable" for our corporate bosses and espouse APIs and frameworks to cure our ill at every turn. Ah the joy of marketing. Buts let not kid ourselves into believeing we have anything less than a full scale mess on our hands..Java, EJB, XML, (provide your own acronym here) or not. |
||||
![]() |
Mark Wallace 07/20/05 07:26:11 AM EDT | |||
I agree that small dynamic sites can ease development by keeping it to JSPs only. Applying a pattern of separating display code and action code into separate JSP files (e.g. http://fusebox.org) allows you to still have well-strutured code (MVC) that can be maintained by a team while still only working in JSP's. |
||||
![]() |
Dan Novik 07/18/05 03:26:13 PM EDT | |||
How long it will take for Sun & co to realize that the development time is also a resource? |
||||
![]() |
Java Developer's Journal 07/18/05 12:32:08 PM EDT | |||
Back to Two Tiers and Plain JSP. There comes a time, for many Web sites, when the transition from static HTML to dynamic HTML has to be made. Whether it's a static company Web site that needs to become a dynamic online store, or a simple collection of family pictures that's become too large to manage with HTML alone, a decision has to be made to move to an environment that makes it easier to build and maintain the site. Deciding to use server-side programming to create your site on-the-fly can become the only option, but what language you decide to use can be a difficult and important decision. |
||||
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Cross-Platform Mobile Website Development – a Tool Comparison
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Immersing into JavaScript Frameworks
- Workday Reportedly Prepping to Go Public
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Book Review: Sams Teach Yourself Java in 24 Hours
- OpenOffice.com Lives
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- The Next Web Architecture
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Is Write Once Run Anywhere Ever Going to Be a Reality?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?

















