Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: JSP best practices

Follow these tips for reusable and easily maintainable JavaServer Pages

Tutorial Details:

JSP technology is an extension of Java servlet technology and combines HTML and Java code into a single file. While Java servlet technology focuses on Java classes capable of generating HTML output with PrintWriter.println() statements, JSP technology abstracts this concept to a higher level. With JavaServer Pages, a Web developer can write static HTML pages and simply add Java code in those sections of the page that need to be dynamically generated. While this flexibility enables rapid development of simple Web applications, it can be abused, resulting in unnecessarily complex applications that are difficult to maintain, reuse, and enhance.

To avoid needlessly complex applications, follow the practices I present in this article:
* Separate HTML from Java
* Place business logic in JavaBeans
* Factor general behavior out of custom tag handler classes
* Favor HTML in Java handler classes over Java in JSPs
* Use an appropriate inclusion mechanism
* Use a JSP template mechanism
* Use stylesheets
* Use the MVC pattern
* Use available custom tag libraries
* Determine the appropriate level of XML compliance
* Use JSP comments in most cases
* Follow HTML best practices
* Utilize the JSP exception mechanism
* These tips will help you write JSPs that are reusable and easy to maintain.
* Separate HTML from Java

It can be tempting to throw all Java and HTML code necessary for a Webpage into a single JSP file. In simple system development, such an approach makes it easy for someone new to the system to locate all relevant code in one place and understand how it all interacts. However, this approach becomes burdensome and costly when the application grows more complex and more developers become involved.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
JSP best practices

View Tutorial:
JSP best practices

Related Tutorials:

Advanced form processing using JSP
This article examines the processing of a user registration form using JSP and JavaBeans while implementing the Memento design pattern.
 
Which JSP book serves up the best lesson?
Which JSP bookAs for Web servers/databases, just mentioning a server in the book is not sufficient to be listed here.
 
JUnit best practices - JavaWorld December 2000
JUnit best practices - JavaWorld December 2000
 
JSP best practices
Follow these tips for reusable and easily maintainable JavaServer Pages
 
To EJB, or not to EJB?
To EJB, or not to EJB?
 
Customize SwingWorker to improve Swing GUIs
Customize SwingWorker to improve Swing GUIs
 
Top 15 Ant Best Practices
Top 15 Ant Best Practices Ant, building and deploying Java applications required a hodgepodge of platform-specific scripts, makefiles, proprietary IDEs, or manual processes. Now, nearly every open source Java project uses Ant. A great number of companie
 
Interesting ...
Interesting ...
 
Advanced Installer for Java
Advanced Installer for Java The quick, simple and powerful msi authoring tool Advanced Installer is a Windows Installer authoring tool which enables developers and system administrators to easily build reliable MSI packages that meet the latest Micr
 
JSP 2.0: The New Deal, Part 3
JSP 2.0: The New Deal, Part 3 More Flexible JSP Document Format Rules The JSP specification supports two types of JSP pages: regular JSP pages containing any type of text or markup, and JSP Documents, which are well-formed XML documents; i.e., docum
 
End-to-end internationalization of Web applications
End-to-end internationalization of Web applications Going beyond the JDK A typical Web application workflow involves a user loading one of your Webpages into her browser, filling out HTML form parameters, and submitting data back to the server. The ser
 
Servlet and JSP performance tuning
Servlet and JSP performance tuning This article describes performance-tuning techniques (PTT) for developing high performance and scalable JSP (JavaServer Pages) pages and servlets. That means building applications that are reasonably and consistently fa
 
Struts best practices
Multiple options are available for solving problems with Struts. When deciding among these alternatives, the choice must be based on parameters such as the scale of work and availability of time.
 
Commons-Math: The Jakarta Mathematics Library
Commons-Math: The Jakarta Mathematics Library The Java programming language and the math extensions in Commons Lang provide implementations for only the most basic mathematical algorithms. Routine development tasks such as computing basic statistics or s
 
Lucene in Action
Lucene in Action Lucene is a gem in the open-source world--a highly scalable, fast search engine. It delivers performance and is disarmingly easy to use. Lucene in Action is the authoritative guide to Lucene. It describes how to index your data, includin
 
JSP Tutorial
This Tutorial is for beginners in the Java Server Pages Technology
 
Proactive Patch Management -- A Policy-Based Approach
This BigAdmin article discusses the benefits of strategic patch management based on service management and maintenance policies.
 
Interoperability with Patterns and Strategies for Document-Based Web Services
In Part 2 of this article, we demonstrate interoperability for document-driven web services with Microsoft .NET (C#) using strategies discussed in Part 1.
 

JSP Hosting
 
Configuring JumpStart Servers to Provision on Sun x86-64 Systems (pdf)
Solaris JumpStart technology provides a mechanism for fully automating the installation of the Solaris Operating System. This Sun BluePrints article describes how to modify existing JumpStart servers to support the deployment of the Solaris OS and Linux
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.