Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


How To Pick A Programming Language: Back To Two Tiers and Plain JSP
How do you tackle all details when the transition from static HTML to dynamic HTML needs to be made?

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.

About Brian Russell
Brian A. Russell is a Java developer for Telvent DTN in Omaha, Nebraska.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

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.

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.

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.

Plain JSPs, with business, data access, and view logic rolled into one, should never be used for anything but the quickest and dirtiest prototype:
http://htmatters.net/htm/1/2005/08/Plain-JSPs-Just-Plain-Wrong.cfm

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.

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.

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.

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.

How long it will take for Sun & co to realize that the development time is also a resource?

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.


Your Feedback
Infernoz wrote: 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 wrote: 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 wrote: 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 wrote: Plain JSPs, with business, data access, and view logic rolled into one, should never be used for anything but the quickest and dirtiest prototype: http://htmatters.net/htm/1/2005/08/Plain-JSPs-Just-Plain-Wrong.cfm
Dev Null wrote: 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 wrote: 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 th...
digereedoo wrote: 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 tr...
Mark Wallace wrote: 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 wrote: How long it will take for Sun & co to realize that the development time is also a resource?
Java Developer's Journal wrote: 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.
Enterprise Open Source Magazine Latest Stories . . .
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE