Leon van Tegelen

Leon van Tegelen

(0 comments, 37 posts)

This user hasn't shared any profile information

Posts by Leon van Tegelen

Bring in the decorators – SiteMesh!

There are several approaches to keep a consistent look and feel for your web application. Lots of times the site will contain a navigation bar, a heading maybe a footer. Of course you can do this using frames or jsp includes. Well frames are probably a thing of the past. And using includes is not very flexible and easy to maintain.
In one of the projects I was involved in we used JSP includes to add a menu on the left of every screen. And then the person responsible for the UI (non-programmer) decided it should be a menu on top of the page using javascript pulldowns. That meant we had to redo every single JSP. Lovely.
Of course you are thinking tiles now. And indeed if we had used tiles it would have been a lot easier.
But this weekend I stumbled upon SiteMesh

SiteMesh is a web-page layout and decoration framework and web- application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel, navigation and layout scheme is required.

SiteMesh intercepts requests to any static or dynamically generated HTML page requested through the web-server, parses the page, obtains properties and data from the content and generates an appropriate final page with modifications to the original. This is based upon the well-known GangOfFour Decorator design pattern.

Well I tried it and I like it very much. It is very easy to set up (less than 5 minutes) and works like a charm. It is non-invasive very flexible and extendable. I think it is easier to use than tiles.

One of the standard mappers allows you to specify a separate decorator for different browser. Again using it is a snap.
Next web-app I’m involved with will use SiteMesh for sure

XmlHttpRequest – blast from the past or future

In several places XMLHttpRequest sprung up this week. XmlHttpRequest is a JavaScript object allowing browser clients to communicate with a server without refreshing the current page. This object originated from Microsoft, implemented as an ActiveX object. But other browser including mozilla are also supporting it now. Amis already built an application using this technology way back in 1999. The guys who developed that system have proven to be quite visionary. The way they built is exactly what Duncan Mills describes in his commentary on a TSSS presentation.

the use of XmlHttpRequest to communicate with the server asynchronously in the background, and populating the page by manipulating the DOM tree. So the page can be updated without refreshing the whole page, giving you things like instant validation and really dynamic screens..

They took it even a step further in creating a behavior (htc file) which they attached to HTML tables. In this way the tables act like multi record blocks in Oracle Forms. The table remains in place and only data change, complete with scrolling. Really cool. Changes in data are cached in an XML object clientside until the save button is pressed. The records are then posted to the server again using the XMLHttpRequest. There the posted XML is handled by a generic “XML to Table data converter”.

Now that it has become mainstream I can see a lot of good uses for it. Indeed validation, dynamic screens but also for example coordinated select list and “smart forms” (completion of entered values). An excellent little example and great introductory tutorial on XmlServletRequest can be found here
It shows how based on a zip code, city and state are filled in in the onblur event of the zip code textfield
Javascript is much more powerfull this way, it can call webservice, query a database etcetera. It’s is not tied in with any serverside language. You can use any language you want, PHP,CGI,Java.

Interestingly enough the response to an XmlHttpRequest does not have to be XML …

new JHeadstart Team blog Announces production release

Oracle’s JHeadstart team does a double whammy, not only do they release the production version of ADF JHeadstart but they announce it on their brand new weblog.

As already mentioned in earlier posts on our blog the new and improved JHeadstart builds on the ADF runtime. For a customer we allready have working with several beta builds. So far it is looking really good. The application (20 master- detail multirecord UIX screens) already meets the specs for about 80 – 90%. When I complied the project last week using an Ant script I noticed the following line ” compiled 2 classes “. Yes, we only coded two java classes to that point, a special LoginAction (10 lines of code) and a BaseAction class. The rest is provided by the ADF framework and JHeadstart extensions on ADF. 2 javaclasses and a big bunch of xml files and the application is working 10 days after we started on the project…..

JDeveloper 10.1.2 bug and release schedule

Recently I ran into a bug in JDeveloper 10.1.2 or actually in the ADF Business Components version supplied with it. Calling getAttributesNames() on a viewobject resulted in a nasty npe. After spending 20 minutes confirming it wasn’t some programming glitch I introduced I checked Google and the otn forums (Yes, in that order) and I found a forum entry where Steve Muench indeed aknowledged it is a 10.1.2 bug. The workaround I my case was quite easy , I made a small utitlity method mimicking the original getAttributeNames.

<code>    public static String[] getAttributes(ViewObject vo) {
    AttributeDef[] defs =  vo.getAttributeDefs();
    String[] names = new String[defs.length ];
    for (int p = 0 ; p < defs.length ; p++) {
      names[p] =  defs[p].getName();
    }
    return names;
  }
</code></code>

As such this doesn’t really merit a post, the bug is not a biggie. But what has been bugging me for some time know is that I can’t get a grip on Oracles release schedule. For example, this bug when will it be fixed? Will there be any maintenance releases before the big 10.1.3 release? Speaking of 10.1.3, when will it come ( April, summer I’ve heard different rumours ). I don’t know. Neither do I know what will be actually in it. True there is a (very good) preview available, but for example ADF is not yet in it. Scanning different blogs and for example the developer poll on the Jdev home page you can get a global view.

But would’t it be nice if there were a dedicated page on OTN keeping us up to date on short term and long term release plans and dates. I would also like to see more frequent (for example monthly) maintenance releases. The 10.1.2 maintenance release contained over a 1000 bug fixes, but we had to wait a considerable time for them.

Templates in Oracle JDeveloper

Chris Schalk has posted a very interesting blog on web templates in JDeveloper 10.1.2 (production) and JDeveloper 10.1.3 (preview). This how-to is only published on the Chris Schalk’s blog

This will surely increase your productivity, when working with custom designs

ADF Faces JHeadstart ?

Andrej Koelewijn spotted a Jason Jacobi post on OTN regarding an upcoming utility for migration of UIX pages to ADF Faces/JSP pages.

The upcoming JHeadstart release will support ADF but not ADF Faces (JSF). This utility makes you think it could be a way to extend ADF Jheadstart to ADF Faces JHeadstart

Locking colums in HTML table (IE only)

In a project I’m working on we have a HTML table with many columns for editing certain records. The users requested the possibility to lock the first column so that when scrolling they could see the context, like they can in for example Excel. In HTML this is not a trivial task.
I found Brett Merkey’s excellent website showing a very simple way to achieving this feature with Cascading Stylesheets. There is one caveat though, it only works for Internet Explorer 5+. In our case that is not an issue luckily.

To speed up the performance considerably with tables with many rows, I made a simple function caching the DIV container . It also encapsulates the div container name on the page instead of the stylesheet.

var container;
function find() {
  return (container != null?container:document.getElementById('tbl-container'));
}

In the stylesheet I then use the following expression

     left: expression(find().scrollLeft);)

(Pre)-compiling JSP for Tomcat with Jasper

When working on a project I like to precompile my JSPs just to test if haven’t made any (syntax) errors or forgot any resources, without having to deploy them on the appserver and testing them one by one.
In a project we are working using Tomcat we use Ant to build the application and package it in war, which is subsequently deployed on the Tomcat server.
This ant build copies all necessary resources to a build directory and starts compilition and war building from there.
I added an extra target to precompile the JSP as follows following the instructions found here.

(more…)

JHeadStart ADF beta

For some time now there have been some excellent viewlets on OTN on the functionallity of the next generation JHeadStart version which will work with Oracle Application Development Framework (ADF).
Because of our special relationship with Oracle Consulting we were able to obtain a beta version of the JHeadstart ADF release. Last month I took it for a brief spin. I must say I really like the fact that it is built on top of ADF. This means JHeadstart can now use the “ADF API” to talk to the model, instead of using its own implementation with DataObjects en DataObjectHandlers. Using the ADF plumbing and extending it where needed the JHeadstart runtime could slim down. JHeadstart can now really focus on its main objective, giving you a headstart with “fast, reliable, and repeatable development of complex transactional systems”.

After some small difficulties were overcome I built a small application (JSP and Struts) based on three tables in an Oracle Database using JDeveloper 9.5.0.2 with the ADF JHeadstart plugin. After setting up the business components, I opened the Application Structure File and a default application already had been configured, I just had to generate and run and the application was working.
JDeveloper with ADF already promisses you “productivity with choice”. But still you have to handcraft each JSP and the application flow by hand. Even with the help of drag and drop and visual editors that will become a boring, time consuming repetitive task when you have a “standard” transactional application. That is were JHeadstart can provide you with an overdrive. It will generate the necessary JSPs , ADF metadata and the struts-config for you.
Besides JSP and Struts controller also the ADFc controller and UIX are supported.

I’m not going to give you a list of the new and deprecated features, just check out the viewlets for that, pictures say more than words.

Looking at the future I think it would be a good idea if JHeadstart would also support ADF Faces (Oracles Java Server Faces (JSF) implementation), as I think that 2005 could become the “Year of JSF”.
Another important question is if ADF (JDeveloper) will eventually provide some of the “application template” functionality JHeadstart offers.

JDeveloper 10.1.2 has arrived

JDeveloper release 10.1.2 is finally available for download (here). This is a maintenance release with some new features and over 1,000 bug fixes for JDeveloper 9.5.0.2.

Leon van Tegelen's RSS Feed
Go to Top