YOUR FEEDBACK
Immo Huneke wrote: A well written article, an ingenious solution to a real problem often encountere...
Cloud Computing Conference
March 30 - April 1, New York
Register Today and SAVE !..


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 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 software engineer for Priority Technologies, Inc. in Omaha, Nebraska.

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.
LATEST ECLIPSE STORIES . . .
Micro Focus has announced the availability of Micro Focus COBOL for Eclipse, encompassing versions of Micro Focus' Net Express and Server Express solutions designed specifically for the Eclipse open source ecosystem. Micro Focus COBOL for Eclipse provides an integrated development en...
Only if you were on the dark side of the moon could you have missed the impact of the iPhone. Its sweeping success has brought mobile services into the mainstream. As the first device to convincingly integrate traditional phone capabilities with Web access, it highlights the multi-chan...
Much like “Web 2.0″, cloud computing was a collection of related concepts that people recognized, but didn’t really have a good descriptor for, a definition in search of a term, you could say. When Google CEO Eric Schmidt used it in 2006 to describe their own stuff and then Amaz...
It’s time to wrap up the year 2008 - a year of change with Obama, the Olympic Games and the financial crisis. It was also the year when Yahoo said no to Microsoft. 2009 will be all about Cloud Computing: the technological hype has started already but the commercial breakthrough will ...
Genuitec has announced the production release of MyEclipse Enterprise Workbench 7.0. The new release, built upon Eclipse 3.4.1/Ganymede, delivers a comprehensive environment for AJAX and Web Services in the Eclipse space. In addition, MyEclipse 7.0 is delivered on top of the Pulse Ecli...
There's a new release of OpenSolaris out – OpenSolaris 2008.11 – out a whole three weeks before the end of 2008. There was a 2008.05 release, aka Project Indiana, in May but that wasn’t as commercial or production-oriented as this one. Both run only on x86 machines, not Sun's own...
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

Click Here

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE