Home arrow Java arrow Page 7 - JavaServer Pages, conclusion
JAVA

JavaServer Pages, conclusion


If you've taken a look at J2EE and JavaServer Pages technology, and want to examine JSP more closely, you've come to the right place. This article is the second of two parts, excerpted from chapter three of Beginning J2EE 1.4 From Novice to Professional, written by James L. Weaver, Kevin Mukhar, and Jim Crume (Apress, 2004; ISBN: 1590593413).

Author Info:
By: Apress Publishing
Rating: 4 stars4 stars4 stars4 stars4 stars / 17
November 10, 2005
TABLE OF CONTENTS:
  1. · JavaServer Pages, conclusion
  2. · The config Object
  3. · Try It Out: Using JavaBeans in JSP Pages
  4. · Translation and Compilation
  5. · The Deployment Descriptor
  6. · Including and Forwarding from JSP Pages
  7. · Summary

print this article
SEARCH DEVARTICLES

JavaServer Pages, conclusion - Summary
(Page 7 of 7 )

In this chapter, we've taken a tour of many of the basic features of JSP pages. With the information in this chapter, you should be able to easily begin creating JSP web applications of your own. After completing this chapter you should have learned:

  • JSP pages consist of HTML data, also known as template data, and Java code.
  • You can specify an error page for a JSP using %@page errorPage=""% . Error pages are used to provide a meaningful error page to a user when something bad happens to the web application.
  • You can import Java packages for the page using <% pageimport="" %>.
  • Java code is included in the page using a declaration <%!declaration %>, a scriptlet <% scriptlet %>, or an expression <%= expression %>. These elements allow you to mix Java code with the template data in the page.
  • JavaBean instances can be created using the <jsp:useBean> standard action; properties of the bean can be set using <jsp:setProperty>; and the value of a beans properties can be obtained using <jsp:getProperty>. JavaBeans are one way to encapsulate business or domain logic so that JSP pages can be used primarily for presentation.
  • Various implicit objects such as request, response, out, session, and so on, are always available to the JSP to help process a request. The session object is particularly useful because it enables the web application to keep track of user information. One example of the usefulness of this is an e-commerce application that needs to keep track of a users shopping cart.
  • Servers translate and compile JSPs into Java classes that behave like servlets.
  • You can specify error handlers for the entire application using the <error-page> element in the deployment descriptor.
  • A JSP can include the output of other JSPs or servlets in the response to clients. This is done through the <jsp:include> standard action.
  • A JSP can forward a request to another JSP or servlet for processing. This is done through the <jsp:forward> standard action.

Thats quite a lot. All these features put together allow application developers to create dynamic and powerful web applications that can be used for many purposes from chat rooms to e-commerce, from virtual communities to business applications. However, you may have noticed that as the examples in this chapter became more dynamic, more featured, they also tended to have more and more Java code interspersed in the JSP pages. This tends to be a problem because web page developers are often not Java developers.

What would be ideal is a way to create JSP pages that hide the Java code from the page developers. This would allow the page developer to concentrate on the format and structure of the markup, and leave Java developers free to work on only the Java code. There are several ways to do this, and we will see some of them in the next chapter, where we explore some of the new JSP features introduced in the latest version of the JSP specification.

 

 


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials