2004-11-29

struts, scriptlets, html taglib and tomcat 4.03 linux

A strange error that I encountered when deploying a webapp to a tomcat 4.03 installation on linux. I feel compelled to post information about it in my weblog to help others who might encounter the same error:

org.apache.jasper.compiler.ParseException: /WEB-INF/pages/freightDetails.jsp(115,51) Attribute has no value

This was caused by a struts-html tag with a scriptlet:

<html:radio property="freightId" value="<%= "" + ((webstore.objects.FreightOption) opt).getId() %>"/>

OK, now I realize it is my own fault that I was being lazy and using "" + to turn the next item into a string... the problem disappeared when I used the following code:

<html:radio property="freightId" value="<%= (new Integer(((webstore.objects.FreightOption) opt).getId())).toString() %>"/>

The bug did not appear under tomcat 5.x on my OSX machine, as it appears to correctly interpret scriptlets in tags.

2004-11-25

work in the USA?

If you happen to know of any jobs in the USA between March and June, 2005 for a web developer ... then please leave a comment or email me (ntt.ntt@gmail.com).

My skills include:
* jsp/servlets/struts
* perl
* asp
* java
* cocoa/java
* mysql
* sqlserver
* familiarity with linux/mac/windows

My wife and I want to work/live in the USA for those 3 months, and I would love to line up some work before we leave!

2004-11-24

cocoa-java

I've been learning cocoa-java lately.

Why? Because i've written a jsp/java powered website recently and wanted to write a custom Mac OSX GUI for the administration of the site. Native applications have a quality to the user experience that just cannot be replicated through a web interface.

Fortunately, Apple has given us an awesome set of tools for writing native OSX GUIs with Java as the logic behind the app.

A few links and notes for those learning or wanting to learn cocoa-java:

Apple's Cocoa-Java documentation

Note: Application Kit framework is the API for all the GUI stuff
Note: Foundation framework is the API for all the Apple classes for adapting Obj-C objects to Java

O'Reilly has a Cocoa developer center, with Java tips too

Miscellaneous notes:

* If incorporating third-party jars into your application, you'll probably need to tell X-code to Merge your jars with the main project jar when compiling. This is an option on the build target.

* NSSelector objects can take a few minutes to get the hang of. Obj-C uses selectors when an event is fired to figure out which object and method to call to handle that event. This means, usually, that your controller object registers itself to receive certain events fired either by a specific object or a class of objects.

* I highly recommend putting all the actual data logic and/or database code into a separate java file from the Controller. This will give you the ability to re-use all that logic in a web-app, or a Swing/AWT app if you find you have users not using OSX.

* For some reason, Exceptions thrown in callback functions (those called as a target of a Selector) seem to get swallowed up. In other words, the catch{} block never gets called. (I could just be doing things wrong). so I recommend putting any code that generates exceptions elsewhere if possible.

Well, that's all for now. I'll post up more when I think about it.

getting started

and so it begins!
welcome to my journal.
i'll be keeping this thing up to date with my latest coding efforts and lessons learnt, as well as some miscellaneous ramblings about life in general.
hope you find something useful or interesting here at some point in the future.