Changes Ahead for JSP Developers

Major ease-of-use modifications coming to JavaServer pages update.

The next version of the JSP Web page scripting language is undergoing major changes for its 2.0 release.

The proposed final specification for JavaServer Pages 2.0 was published Aug. 16. Before Version 2.0 can be finalized, however, reference implementation and compatibility test suites must be developed. Specification changes could still occur, but they will be as minimal as possible, so now is a good time for Java developers to look at what will be in next yearís products.

JSP 2.0 has three major changes, all of which make the language significantly easier to use for non-Java programmers.

First, JSP 2.0 includes the new JSP Standard Tag Library, a collection of JSP tags that provides a large set of standard programming functions, including session manipulation, try/catch blocks, conditionals and loops. There are also tags for HTTP URL access, internationalization, date and time formatting, submitting SQL queries or updates, and manipulating XML data. These changes move JSP toward the strictly tag-based page development style popularized by Macromedia Inc.s ColdFusion.

Second, JSP 2.0 supports a new expression and variable manipulation syntax based on both ECMAScript and XPath. This expression language provides built-in support for nested data structures and collections of objects, automatic type conversion, and default values for uninitialized variables.

Both of these are big steps forward and make it possible to write significantly more complicated and feature-rich JSP pages without having to drop down to using embedded Java code. Administrators can now flag and prohibit pages that have embedded Java script, for cleaner separation of presentation JSP code from back-end business logic.

Not having to continually switch between a tag-based syntax and Javas procedural syntax will make JSP more accessible and consistent. The move to allow developers to use an untyped variable assignment system alone is a big advancement because it means JSP developers dont have to understand Javas data types and continually convert between them to avoid compiler errors.

eWeek Labs uses JSP extensively in internally developed applications, and we believe these are great changes, particularly the expression languages support for default values. We wont have to write a block of boilerplate code at the top of every page that turns unassigned string parameters into assigned empty strings to avoid null pointer exceptions later in our code. The scripting language will do it automatically.

The JSP Standard Tag Library includes the scripting language and can be run on current JSP 1.2 servers if manually installed; check out the Apache Software Foundations implementation.

The third change is the ability to write custom JSP tags in JSP syntax instead of in normal Java, making them easier to create.

West Coast Technical Director Timothy Dyck can be reached at timothy_dyck@ziffdavis.com.