Java, Struts, OJB

If I haven’t mentioned it before one of the things I’ve been doing at work lately is designing and coding portlets for our new IBM WebSphere Portal server. A portlet is basically a Java applications (Java and JSP) with some extra code so that the application can be deployed as a portlet and can interact with the portal. Otherwise, it is like any other Java web application. It has been a learning experience from the start for me. I’ve known Java programming for a number of years now and have been doing web programming in other languages for a couple years too, but putting the two together didn’t happen until recently. Now that I’ve done it I can say that it is a pretty nice environment to develop using, but it is more complicated than say ColdFusion.

To ease the complication we’ve been using Apache Struts and Object Relational Bridge (OBJ). Struts when you first use it can be complicated, but it makes it easier to write cleaner code and is pretty easy to follow. With Struts and some coding standards you can create some pretty sound code that is easy to use and maintain. The only other problems is creating connections to the database and writing SQL queries to select, insert and update data. Then there came OJB. I look at OJB as an abstraction layer. It is basically a layer between your code and a database. Any database. Once your code is written changing your backend database is as simple and editing a configuration file. The code never changes. You write your code using the OJB APIs and it takes care of connecting with and tranferring data with the database.

I’ve been trying to get Sue up to speed on both Struts and OJB. She has been working on a Java web application where she works and without these you need to constantly write the same things over and over. From my experience once you have your beans created and OJB configured you database connections are complete. Once you create you form beans and action classes, JSPs and configure Struts your basic application framework is ready for you. You can then focus on the actual application instead of all the other things.

The only problem is that where Sue works her hands are tied and her management does not like suggestions. She moved to a new group and they seem more receptive to new ideas. I’m hoping to show Sue that with the right tools it is easy to write an application. She can bring it in and show them a sample.

One other thing about Java programming. We’ve been using IBM Rational Software Developer, which is an IDE written using Eclipse. It does quite a bit and has plenty of nice features. I found out recently that many of the coding features I like such as refactoring and generating getters and setters is actually part of Eclipse itself. So, if you are writing Java code try using Eclipse. It works pretty much anywhere out of the box and has a handful of good tools. The only complaint I have is that it doesn’t do syntax highlighting with JSP files. However, you can download or develope plugins to do pretty much anything you need.

Leave a Comment

:) :( :d :"> :(( \:d/ :x 8-| /:) :o :-? :-" :-w ;) [-( :)>- more »