JSP Insider - http://www.jspinsider.com

News - Articles/Tutorials/Code/Reviews - JSP/Servlet Hosting Companies - Links

JSP Buzz: Vol II Issue #12

JSP and Java Newsletter

6.26.2001

Table of Contents
  1. Oracle, Sun Grind MS Into Java
  1. Some Thoughts On Current State of The Marketplace
  2. HTML Based Newsletters
  1. Under the Hood of the JavaOne Web Site
  2. JSP Tag Libraries and the TagSupport Class
  3. Java Tip 112: Improve Tokenization of Information-rich Strings
  4. Honeypots and the Honeynet Project
  5. J2EE Moves To The Next Level
  6. Does Anyone Really Xp?
  7. Access Everybody Wins
  8. Learning JDBC
  9. Filtering and JSP
  10. A Look At Some Data Features Of XML Schema
  11. Smash Your Web Site
  1. Struts 1.0 Production Version Released

Part 1: Building an XML/XSLT/JSP based Newsletter


News
Oracle, Sun Grind MS Into Java
ZDNet   6.18.2001  
Sun and Oracle are teaming up to produce a set of tools to make it easy to convert Microsoft-based software into Java software. Among the tools will be a ASP to JSP converter. It only seems to generate to the Oracle platform server, which might limit its usefulness. The release date of the tools will be in two months. To find out more check out:
Oracle
Rambles
Some Thoughts On Current State of The Marketplace
Casey Kochmer  
Since writing the quarterly review of the last issue. I have come across additional material to supplement the information I presented in the article. This material is meant to compliment the quarterly review from the last issue of the JSPBuzz.
JSP / Server Side Java Market Quarterly Review
For some additional Analysis of Microsoft's Position against Open Source.
For timing on economy:
For more on the slump in OS/PC sales
For some additional review about web services:
( As a side note I think the rush of web services mentioned at the end of the article will be one that will be years in the making and in the short term it would be wise to be cautious until experience matures fully in this market.)
For more on Chip Prices
Chip prices are falling faster and harder than expected. This is strong sign we won't see a market recovery this year.
Finally DevX has a big review of the Java Market.
My conclusions really haven't changed much since the writing of the article in the last Buzz. I would say at this point the recovery will be a bit slower than I was hoping for and will happen in first quarter of 2002. Again, I also believe everything will hinge on the October/November stock market. Until then things will be slow. The strength of the market at this point will determine how confident IT managers of their own future and the risks they will be willing to take with web applications.
HTML Based Newsletters
Casey Kochmer  
With the JSPBuzz switching to XML over this and the next newsletter, I have decided to keep the newsletter being sent out in simple text format. My logic is that any one who is interested in the snazzy new HTML version can read it on the site. I personally prefer the old fashion text base email version over getting HTML documents. However, its your opinion that matters more in this question. So I would like to ask the Buzz readers do you perfer a text base newsletter or would you rather have a snazzy HTML version? I know, I could be really fancy and offer two different formats to be sent out, but I rather hold fast and deliver one format over email.
Thanks for your feedback.
Links
Under the Hood of the JavaOne Web Site
Eric Larson   6.1.2001  
This is a case study of the JavaOne web site. It is an interesting review on the structure of the web site and the methodology used in data access. This article will be of interest to programmers thinking about building a site requiring access to multiple servers and databases.
JSP Tag Libraries and the TagSupport Class
Piroz Mohseni     
This is for newer programmers still learning Tag Libraries. A quick look at the helper classes used to build Tag Libraries within JSP.
Java Tip 112: Improve Tokenization of Information-rich Strings
Bhabani Padhi     
This article shows how to expand the StringTokenizer class to be more robust. The article also talks briefly about tokenization. For newer programmers tokenization is the act of breaking an input string based on a separator(delimitor) into sub strings(tokens).
Honeypots and the Honeynet Project
Bruce Schneier   6.15.2001  
I personally feel this is a must read link as it gives an accurate idea on how vulnerable our web sites are to outside attack. Security is always an important concern as a web developer. This article will give you perspective why security is important. If you think your server is safe because your site is a small site, think again! To illustrate this point check out the following link.
Story of One Web Master
All in all the point is that no matter how good your security is your web site is never going to be 100% safe from attack. Unfortunately, I don't have any answers to these problems, the best solution is to have expert help and have solid backups. The problem even the experts aren't 100% safe. Welcome to the reality of web sites in the new millenium. Oh well...
J2EE Moves To The Next Level
Harry Evans   6.2001  
Harry examines the current state of J2EE. This is a high level and quick overview of what face J2EE showed at the JavaOne conference. In summary J2EE is both mature and growing to meet expectations of the business world.
Does Anyone Really Xp?
Daniel H. Steinberg   6.2001  
This article reviews a presentation at JavaOne which discusses how to change extreme programming to fit your shops needs. It has some good points and in some respects doesn't go far enough in the ways it is possible to modify the extreme programming. Food for thought if you are interested in extreme programming.
Access Everybody Wins
D. Keith Robinson     
Building a web application is something that has many levels of design. The most basic level is simple access, who can and can not view the page. This can be difficult task due to all the various combinations or client tools or disabilities a user might have in accessing the page. This leads to the problem of many standard web pages are just not accessible to people with disabilities. Ignoring this market can only be done at your own risk as a web developer, since you only alienate a large user community. In addition, if you build sites for any government in the United States you are now required by law to make the site accessible to people with disabilities (The Workforce Investment Act Of 1998 is in effect as of this month). This article reviews issues regarding site access for people who might have access problems to a site.
Learning JDBC
Java Skyline     
Using a database is critical for most web applications and JDBC is integral part of the picture. Java Skyline has a nice collection of resource links and helpful hints collected at this link. The page has been recently updated to include a section on prepared and callable statements.
Filtering and JSP
Sing Li   6.2001  
One thing for sure, the one feature of the Servlet 2.3 specs which has been drawing the most attention is the ability to filter. This is probably the 3rd or 4th such article referenced in the buzz over the past few months. But filters are well worth the airplay as filters open up JSP to many exciting capabilities. This article walks you through how to use filters and even better you can try it all out now with Tomcat 4!
A Look At Some Data Features Of XML Schema
Kevin Williams   6.2001  
A quick look at why the XML Schema specification is a solid way to go with defining your XML pages.
Smash Your Web Site
Martin Lindstrom   06.12.2001  
Commentary on web site design. If you are building a commercial site then this is well worth the time to read.
Products
Struts 1.0 Production Version Released
jakarta   06.15.2001  
The 1.0 version of struts has been released. If you are looking for a framework to base your JSP site upon then check it out!
Main Topic
Part 1: Building an XML/XSLT/JSP based Newsletter
Casey Kochmer  
Introduction:
At the JSP Insider site we are in process of switching over to XML based data sets to drive building the site. Within this process the JSPBuzz newsletter is also getting converted to be stored in XML format. This is a start of a series of articles and it will cover the process used in using XML, XSLT and JSP for the JSPBuzz. This first article is set up as an over view of XML and XSLT. It will mostly be a high level discussion of what is required to use XML/XSLT within a project. This first article is geared toward both project managers and programmers just starting to think about XML and XSLT. More experienced programmers will want to wait for the next installment in this series. The next article will get into the coding and show tricks and techniques to make using XML and XSL easier for the programmer. Then the final article will show how to merge this with JSP and how to use JSP as an engine to generate all the required documents using the XML and XSLT.
Impressions of Using XML and XSLT
XML has already proven itself within the technical community. The problem with XML is not using it, but rather how to apply it. Converting data into XML takes time and does require extra work. Quite honestly, programmers and projects should not rush into using XML unless they understand this fact. Lets use the JSP Buzz as an example. If the JSPBuzz was purely just a newsletter, it would not have been worth the time to convert it to XML! The JSPBuzz consists of many small articles which need to be typed, formatted , proofed, and rewritten several times before a final copy is produced to be sent to the readers. This multiple pass process means it is easiest just to leave and write the JSP Buzz initially as a text file. A text file makes life simple for the authors and editors to quickly proof, edit and fix. After the JSP Buzz text file is finished, the data from the newsletter needs to be entered into an XML file. For the authors this is an extra step and extra time spent within the process. If only a text newsletter is required, there would no reason to spend the extra time to store the JSPBuzz data into an XML file. However, lets examine the basic processes that the JSPBuzz sits within for Amberjack software. The JSPBuzz is more than a newsletter. Three different versions of the newsletter are used by Amberjack Software. We send out one text based and have two online versions. In addition, the JSP Buzz is used to feed links into our main site. Finally, in the future we will be offering the JSP Buzz for other sites to use as a newsletter. All this means of course, more work is involved than just maintaining a single text file. This means, the extra week or two spent in creating and tweaking the XML/XSLT formats will be worth the time to convert the text based version into an XML data set. Once an XML format exists, it becomes a relatively easy matter to create different XSLT style sheets to drive out the multiple versions of the JSPBuzz. Short term it is a pricey hit in time to convert and use XML for the JSPBuzz, long term however, more time is freed up as the automation of the multiple styles is now easy to achieve. Also we have the capability to expand the newsletter for other vendors.
First Step: Building an XML File layout.
The most important step is also the first step, building the layout for your XML file. This will be similar to designing a small database. It will become necessary to plan on this being a several step process really.
A) An initial design will be required to hold the data. This basically means two different things. The first is most obvious, creating the layout needed to hold the data. The second aspect required in the design are what attributes are needed to support the destination layouts. Technically an XML data file is just for storing data however, our newsletter has additional meta data in the form of the layout. While The XSLT style sheets represent the presentation layer, the style sheet still requires clues for our XML dataset on how to format the data. For example, we store position number of each link. This permits the XSLT style sheet to order the links correctly relative to the display outlay we are interested in showing to a reader. The other consideration is that design of the XML data file should make it possible to only put content in the file. It would be bad practice to include HTML formatting within the data. All presentation logic should be performed within the XSLT style sheet. However, in order to remove the need to embed HTML logic creates the need to include some formatting attributes within the XML.
B) A data dictionary is required to define your data. In the world of XML this means creating either a DTD or a Schema. While I recommend using a Schema to define your XML file, a DTD was used for the first cut on the JSP Buzz layout. DTD's are older and well established. Schema's are more flexible and are in XML format themselves.
C) Enter data into the new XML files. The fact of the matter is that the data still needs to be pushed into the XML file. While it would be nice to automate the generation of XML files, many times it may not be practical. Case in point is the JSPBuzz. A text file just is the most efficient method to create, edit and modify the data for the initial creation of the JSPBuzz. Some companies will want to build special interfaces to enter the data to XML, others will opt to use an XML IDE. However, the generic XML IDE's are still not quite easy enough to use for this purpose.
Now the fun part just begins for this is an iterative process. This means during the next steps of building the XSLT style sheets new details will be discovered by the programmer. So change and tweaking is an integral part in creating the XML data format. As a result, it should be expected that within the first part of your project the overall process will be repeated several times as the design gets optimized to support various destination clients. The good news is that each design change will get smaller as time goes by, but the bad news is building the XML file is not a single day project. Expect the XML design phase to last for the first 2/3rds of the projects overall initial design stages.
Second Step:Using XSLT
The second step is easy from a perspective that XML style sheets for formating XML data are being built. In a nutshell, the programmer is using XPath as a language to parse their way thruogh an XML document and convert it to a new document. Once built the XSLT document is reusable and will be used to generate a HTML or text based output file.
That is all that is involved in the second step. However,it would be nice to add a brief taste of the flavor of development happening within XSLT. In projects like the conversion of the JSPBuzz, the use of XSLT is a server- side process to occasionally produce HTML files on a need only basis. Once built these file won't need much tinkering, however, the building of the file is a slightly messy process. I recommend building these XSLT style sheets in an onion like manner, in layers. The XSLT style sheet will consist of many small templates to parse through the XML data. Don't try to build everything in one pass. Instead build by groups of templates and test. It makes building the XSLT style sheet easier and doesn't add much time to the development. In the case of the JSPBuzz templates it made life easier as many of the templates were reusable with slight modifications.
From this experience of building the JSPBuzz style sheets I would like to comment on the fact that XSLT is an interesting beast. In some ways it is very much like JSP since it uses layers of logic. With XSLT the programmer will be weaving XML, XPATH and HTML together to produce a final output. In some respects the JSP skills in combining client and server side mixing will come in handy with using XSLT. Becuase of this JSP programmers will have an easier time learning XSLT. The biggest problem comes from the lack of solid tutorials and strong tools to make life easier.
Third Step: JSP
Automate the processes with JSP. As a server-side tool, JSP is availible for building the templates to pull everything together in a XML/XSLT project. JSP is not only for building web applications, it is a tool for generating data for a client. In our case we will use JSP pages to generate our JSPBuzz pages automatically for the site. While the client will be our own server, that still works as a client. Why use JSP? Because JSP has a simple interface. Also as JSP programmers we still have access to all of the Java tools which can build, modify and use XML in any fashion. The goal is to minimize the amount of work we actually need to perform, and reusing JSP is both easy and leverages a language we have experience within. This makes it a perfect tool to automate the final generation of the pages we need.
The last article in this series will show how to use JSP for automation of the XML/XSLT processes.
Resources:
Getting Started using XML
W3Schools
This series of articles will not teach much about the XML portion of the project, so if you need to learn more about XML basics W3Schools is a great place to get started with XML. This site has excellent resources to help newer programmers learn the basics of XML, DTD's and Schema's.
Getting Started Using XSLT
A list of resources which are helpful in XSLT.
XSLT poses a bigger problem for a programmer. Solid informational resources are still few on the internet. To make things worse using XSLT is a several step process. That is, in addition to the XSLT style sheet, finding and learning how to use a XSLT template engine to run the XSLT and XML together is also required to get a final results.
Mozilla Browser
The latest version of Mozilla browser has begun to incorporate XSLT support within the browser. While this support is still sketchy, it bodes well for the future as Mozilla gets expanded to work with XSLT in a more complete fashion. I still recommend IE 5.5 as the perferred way to test and use XSLT currently.
Tools
XML Spy
As a programmer I am not very happy about the selection of tools availible to make my life easier using XML and XSLT. While it seems like many software makers talk about how XML\XSLT is awesome, few high quality tools exist. A text editor is still a good way to go for most XML work. The one professional tool I have been using of late is XML Spy. I will have a full review of this product in the next issue of the buzz. In the meantime if you are looking for an XML IDE to help, it is possible to download a fully function version of XML Spy which works for 30 days.
Conclusion: XML and XSLT are a great combination of tools which come at a price of building additional infrastructure. Using this pair of tools will greatly expand the ability to reuse and reformat existing data. However, to maximize the benefits means spending extra time up front to design the framework on how XML and XSLT will be implemented for your project. Using XML/XSLT is not just something that gets drop into a project, it is a different way of thinking on how to make your data reusable within your project. This means using XML and XSL will result in some modifications in how a project's business model will work with the data. The next article in this series will examine using XSLT in detail and tricks and traps a programmer faces in XSLT. The article will also include examples from the JSPBuzz newsletter which will give a template for programmers to use in building their own newsletter.

Browse all of the JSP Insider source-code.

Questions or comments? Contact support@jspinsider.com.