Today is a good day to code

How the JSTL Could Save My Life

Posted: December 31st, 1969 | Author: | Filed under: Companies, Sun Microsystems, Uncategorized | Tags: | No Comments »

How the JSTL Could Save My Life

Picture of Irv Owens Web DeveloperThe JSTL is short for Java Standard Tag Library. What it does is to take common tasks done by web developers and make them easily callable by using a standard xml style tag within a HTML / XHTML / XML page. This is great because using JSP at and before 1.0 was often difficult because developers had to embed entire classes in web pages, or create external classes and link to them. JSP 1.1 introduced the JSTL and made some other improvements like being able to write code fragments, or Java without having to follow all of the usual rigors of writing Java.

One could create a function or method without having to wrap it in a class. Perhaps some of you are thinking, “Why would anyone want to pervert Java in this fasion, all this would lead to is a bunch of unmaintainable code.” The people who are thinking this probably already have a good library of Java classes laying around that they can call on to do simple tasks.

The first time I wrote “Hello World” as a JSP page the old fashioned way I immediately went back to PHP and ColdFusion. It just didn't make any sense to write all that code simply to print one fragment of a sentence “Hello World.” If I remember correctly, it took something like four to seven properly formatted lines to get a single line of output. To a developer that has been doing ColdFusion or PHP, this is ludicrous. So, let's compare the JSTL with ColdFusion and PHP and you'll see why I am so pumped about it!

To begin, I downloaded the netBeans 4.0 IDE from Sun. This is probably the best Java IDE around. It allows for visual J2SE development, for desktops, making creating interfaces a breeze, admittedly a tough point for me, it also assists in JSP development. A development copy of Jakarta Tomcat is installed inside the environment so you don't have to have a JSP wrapper installed. In addition to the usual help documents there are sample applications included in the download. You simply have to create a new project of the type sample, and select the JSTLSample project. This will create a plethora of code and examples for you to browse at your leisure.

One of the tough points was that initially I couldn't get my JSP to work. The reason I found was because I didn't have the JSTL class files in the right place, and I didn't really know where to look. Fortunately, I had the samples as an example, and I was able to figure it out. I got everything to work by downloading the proper files for the JSTL from the jakarta website.

At first, I didn't know where to put them, but after some poking around I discovered that you had to put them in a folder called “lib” under the “WEB-INF” subfolder in the project. There were a bunch of files in there after I unpacked the downloaded archive, and I didn't really like that, so I kept looking and found out that all those jar files could be archived into one massive jar file. I got that out of one of the tomcat “ROOT” folders that were part of another intallation. Anyway, once I got that in place, I was ready to go. All JSP pages that are going to use the JSTL need to call it out by pulling in a taglib.

There are several taglibs that provide the funcationality for the ever expanding JSTL standard library, and there are custom taglibs created by some very intrepid JSP developers of which I hope to be someday. The way you call out the most basic JSP taglib is as follows:

<@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" />

This initializes the core JSTL library which gives you commands to iterate over a dataset, set variables, and evaluating expressions. The other libraries include a functions library that does things like localization and finding and replacing substring elements with other values. It also includes a sql library that has everything a developer would need for setting up a data connection to a database using a JDBC driver. You can set the datasouce, then you can pass SQL to the server and handle the returning dataset. There is a formatting library that will allow you to do date and number formatting. The functionality is very good for such a young technology.

There is some overhead in processing the tags vs raw Java, but it is negligable, and with the great increases in code readibility I am sure we all can agree it is worth it. Now, a code example of JSP using JSTL. This is the first JSP page I ever wrote.


${i}

That's it. This code will, in a HTML body, count from 1 to 100. To compare that to ColdFusion:


#i#

Kinda looks the same doesn't it. It is pretty obvious that the developers working on JSP are going for the same ease of use and readibility that ColdFusion provides as well as allowing for complex Java coding in the back end. Of course as with ColdFusion, you can make your own Java tags that perform whatever task you can dream up.

With some community support, the JSTL could become every bit as functional as ColdFusion, and remain pretty much open source. The great thing here is that on can maintain more control over their source as they are distributing compiled files that have their Java code inside of it instead of ColdFusion templates that can be opened in any text editor revealing all the juicy proprietary code inside.

The reason the JSTL will save my career is that I have not seen any public statement from Adobe about what they intend to do with ColdFusion, and with the JSTL I am less concerned, because I know that I can ramp up on it quickly since I have been working on Java for the better part of a year, and I can produce clean readable code. The ability to extend the JSTL with ease is also very appealing especially for custom server functions for web applications. I'd say that JSP's future looks very bright indeed, and we'll all continue to hope for the best for ColdFusion

Here are some links for more info on JSP

Jakarta's Taglibs
Good Article from Sun Microsystems on the JSTL
A good article from JavaWorld on the JSTL


The Future of Scripting

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, Companies, Microsoft, Programming, Sun Microsystems, Uncategorized | Tags: , , , | 1 Comment »

The Future of Scripting

Picture of Irv Owens Web DeveloperInitially I wanted to stay away from scripting languages as a developer due to the fact that they weren't really programming languages at all. For some time I was reluctant to even call myself a programmer until I built my first Java desktop application. In CNET's open source blog today, they ask the question has scripting peaked?

Scripting hasn't peaked out yet. The reason is clear. Building a web site with C++ or Java is like driving an armored tank to your mailbox. It is that ridiculous. The funny thing is that even Microsoft realizes this, giving their ASP.net developers two languages to choose from when developing web applications. There are many reasons for enterprises to choose C# over Visual Basic when building a web application, especially if they already have desktop and client-server applications built using the technology. It would be possible to completely reuse many of the methods used in the desktop application for the web application. The frameworks built into J2EE as well as C# allow for robust development making it less likely that a developer will lose control of their code. Still, using these technologies and frameworks where a scripting language and a light framework would do adds un-necessary overhead to a project and can push deadlines out unreasonably.

Here's what I see. PHP is a fantastic scripting language that has no real back end and therefore is suitable for light to moderate customer facing websites and some intranet applications. Use of PHP in this regard will only continue to grow. I think some of the 25% decline in worldwide use is a reactive measure to PHP's early security vulnerability. PHP is losing ground quickly to ASP.net and VB scripting as Microsoft's Server 2003 is more widely adopted. Personally I think that LAMP is superior for many tasks, but ASP.net is almost ubiquitous now, hosting and maintenance are cheap. I'll continue to use PHP for light jobs, but at the same time I realize that this is just a preference and performance-wise ASP.net is better. Talking about Java… Sun needs to buy ColdFusion from Macromedia / Adobe. It should be THE Java application server. There is no cleaner and easier scripting language, and it has nearly unlimited flexibility and is design-pattern friendly. Why this move hasn't occured yet is beyond me. It would have made sense for Macromedia to sell it, but I think the issue is that Sun has many proud engineers who love to over develop products. The thought of supporting something as business friendly as ColdFusion probably makes them sick. The business case for this is probably that Macromedia probably sees the big picture and that there are big bucks in ColdFusion, especially now that enterprises are seeing it as a way to get around JSP's notoriously long development cycles.

I see scripting as having a bright future, and I'll tend to side with Zend's guys as saying that regardless of how the Evans study got its numbers, PHP is increasing in use not decreasing. I'm not sure if it is true, but if the next version of IIS is going to have PHP support built-in, I'll be seriously considering going with a Microsoft server in the near future and running it alongside ColdFusion. I like PHP, but I just like ColdFusion better.

news.com – Scripting's demise


Privacy on the Internet

Posted: December 31st, 1969 | Author: | Filed under: Companies, Sun Microsystems, Uncategorized | Tags: | No Comments »

Privacy on the Internet

Picture of Irv Owens Web DeveloperPrivacy on the internet is a myth. If you want to keep your personal information, or public information like your address and phone number, then don't have anything to do with publishing on the web. It makes no sense that someone would post something on the internet and then think that it can remain either out of reach of the search engines, which most search engines do an incredible job of, or that your information can be kept from zealous searchers.

There have been a number of articles recently about people unhappy with facts about them being made public, or being publicized. I can only say that anyone who posts on the internet has only one single chance for anonymity, and that is that their site gets drowned out among the noise. If a web publisher's site becomes even marginally popular, they are open for scrutiny and their information is fair game. All web publishers take this risk, especially in the age of search engines where your posts are indexed as soon as you write them. All it takes is one backlink, and sometimes not even that. With domains, everyone knows that your information is not private when you register a domain. That is why you should provide a bogus phone number, and a valid email address. You should get yourself a P.O. box to list on your registration so that junk mail doesn't come to your house. You have to do these things if you don't want to be bothered.

What is interesting about all this is that people never seem to mind when someone figures out where a celibrity lives and thousands of fans, crazies, and journalists descend like vultures to surround their house and take naked and unflattering pictures of them. People seem to figure that they have somehow asked for it by being famous. Well guess what everyone, anyone who publishes anything on the internet takes the risk of being famous. And while this is really cool for many things, it is definately uncool for others. Perhaps people should think about that the next time they read some sensationalist article about a superstar, or look at topless pictures of an actress sunbathing on the internet. They should think about how it would feel if it were them. Perhaps they would have more compassion, perhaps not if they are exhibitionists, but they should at least think about it. Personally I don't really feel bad for the guy, the one with the foetry.com domain. He is probably making a small fortune off advertising on his site, everytime CNET or any of the other media outlets link to him. His PR is probably 6 or better by now. He should enjoy his 15 minutes of fame. That's all most of us get.


Pentium M iBook at MacWorld

Posted: December 31st, 1969 | Author: | Filed under: Companies, Sun Microsystems, Uncategorized | Tags: | No Comments »

Pentium M iBook at MacWorld

Picture of Irv Owens Web DeveloperThe Pentium M is definately a step above the G4, in every way, but I still don't think that I'll be upgrading right away because of Rosetta.

Rosetta is really cool. I'll give Apple that. It just isn't fast enough. I do not intend to pay for upgrades to the Adobe Suite or to the Macromedia Suite MX just to make them run faster on the intel macs. Adobe has been pretty clear that they will not be offering a free upgrade for existing users so that means we'll have to pay.

I'm not sure about Java. Technically it should just run, but since I am not certain what's involved, and since Sun hasn't said anything about creating a VM for Darwin x86 so that means that until they do ColdFusion is either out of commission, or it will have to run through Rosetta, both of which are unacceptable for me.

I'm sure all of this stuff will shake out, and it is better for Apple to get their x86 machines out sooner rather than later. I am just not sure once the reviews come out with how slow Rosetta is that many people will upgrade. Probably the people who use only the iLife suite, and iWork will be fine. The Apple pro apps will work well, that is probably why they came up with a photoshop substitute and the audio software that they did. The knew that there would be no Pro-Tools for MacIntel. At least not for a while. I can assure you that performance will not be acceptable in emulation. Well, it's OK. My G5 and iBook should hold me until the end of '06 when it might make sense to upgrade my software, but even if I don't they will be fat binaries so I won't have to worry about it.


Solaris 10 Installer

Posted: December 31st, 1969 | Author: | Filed under: Companies, Sun Microsystems, Uncategorized | Tags: | No Comments »

Solaris 10 Installer

Picture of Irv Owens Web DeveloperOver the past couple of nights, I've been trying to get Solaris 10 to install on my Virtual PC installation. I am using Virtual PC 5.0 for Windows for a while now. I say trying because the installer is needlessly difficult. Now it could be because I am a Solaris newbie, or it could be that it just doesn't install in Virtual PC, but man while it has some cool technology in it, I just flat out gave up on it.

Now I am not a Linux newbie. I've run all manner of Red Hat, my primary machine is a Max OS X box so I can get my hands dirty in the shell sometimes there, I was even able to easily install Ubuntu Linux in the same Virtual PC setup. I did have a slight problem getting the resolutions to come out allright, but I just rebooted to the console by selecting some type of “safe” mode, edited the etc/X11/xfree86conf file with VI. It turns out that the problem was that Ubuntu defaults to 24-bit color depth on install. That would be great if I were installing into a real machine, but on the Virtual PC, especially the version that I am using, it doesn't work. The screen is horribly distended and it is almost impossible to make anything out. Changing the resolution down to 16 bits at 1024 x 768 made all the difference. Upon reboot Ubuntu was up and running in VPC. So far, I really like it. It is pretty user friendly, Gnome looks and works well, and they have a really easy updater. If there is a Linux distro that can take on Windows, this is it. There is still no substitute for Mac OS X, but then again Windows is at least two years behind it, if it can catch up at all.

If Sun wants to make Solaris better, they really need to support more hardware. Even when I tried installing Solaris natively on my machine, they didn't have drivers for the nForce 2 chipset. It isn't like the nForce2 is a super new chipset that no one has drivers for. Maybe if I had a Pentium II? They need to get with it anyway. Perhaps the open source movement can do something with Solaris, otherwise I am not going to touch it until at least 11, if ever. I think that I'll stick with Ubuntu on this machine. It is really friendly and very compatible with me.

Ubuntu Linux