Category Archives: Web development

Image buttons made simple

I read a blog post recently showing how to create a button with an image and text. The button looked very simple and very nice to look at, but the HTML was more complicated than I thought it needed to be.

There is a move now to make the HTML of a document as simple and self-explanatory as possible. The HTML should contain the intent of the page, CSS (and possibly JavaScript) is then used “skin” the page as required. This has become more feasible now that browsers are finally maturing and supporting more and more of the CSS standard.

So, if we want a button, we should use the <button>…</button> tag. If we want to have an add button, we want to have:

<button class="imageButton add" 
       onclick="addSomething(); return false;">Add Something</button>

And instead of this

we want it to look like this:


Continue reading Image buttons made simple

Table Drag and Drop JQuery plugin

I’ve been using JQuery for a while now and really agree with its tag line that it’s the “The Write Less, Do More, JavaScript Library”. We’ve also got this code for dragging and dropping table rows that has proved very popular, so it seemed natural to combine the two and wrap up the table drag and drop as a JQuery plugin. Continue reading Table Drag and Drop JQuery plugin

Poll: A yes/no question in a web form, which control(s) would you use?

We’re creating a web application that asks a number of questions about pumps (as it happens). Some of these questions are typical yes/no questions. But we need to make sure the user makes a positive choice. We don’t want to impose a choice on them. Which controls would you use?

Here’s the question with the three options we’ve currently got:

Do you need a sealless pump?
Do you need a sealless pump?
Do you need a sealless pump?

Jakob Nielsen at useit.com in his article Checkboxes vs Radio Buttons tells us that radio buttons are used “when there is a list of two or more options that are mutually exclusive and the user must select exactly one choice” and a single checkbox is used “for a single option that the user can turn on or off”. But this case is a little special since we don’t want the user to forget to select something. The nice thing about using the radio buttons or the drop-down is that you have a way of detecting if the user has actually chosen anything yet. On the whole though, the drop-down list is probably the least user-friendly though perhaps the easiest to generate programmatically.

[poll=1]

(This poll is a great WordPress plugin developed by Lester Chan)

Following symbolic links in Tomcat

We have several web applications derived from the same code base and as well as sharing the jars in WEB-INF/lib, we provide set of administration pages to allow users to configure and administer the applications. Until now, we’ve always had to make copies of the admin pages and this has caused us configuration headaches as we try and make sure that all the applications have the latest versions of all the pages.

But now I’ve finally managed to work out how to make Tomcat follow symbolic links—and it’s very easy! Continue reading Following symbolic links in Tomcat

Groovy, DSLs and Rules engines

This article describes how we used Groovy to create a DSL for the clauses in a rules engine. We have been collaborating in the development of an “expert system” application for KnowledgeBench Ltd. This application uses a forward chaining rules engine to provide a “smart” system capable of creating formulations in domains such as pharmaceutical tablet formulation, inhalers, paints, food & drink and cosmetics. Continue reading Groovy, DSLs and Rules engines

Internet Explorer caches Ajax pages, and how to stop it

Caching pages leads to a speedier browsing experience and so is a good idea. Replacing information within a web page using Ajax similarly improves the user’s experience. The problem comes when the browser caches the information from the Ajax request. It’s a logical thing to do, but it’s not normally what the developer wants.

There are a number of ways round this. Continue reading Internet Explorer caches Ajax pages, and how to stop it

Firefox has overtaken IE on our site

I’m afraid that I don’t know exactly when it happened, but looking at our web-stats (produced by AWStats), the top ten browsers used to access our site are as shown below. It’s not representative of course, but it’s interesting that Firefox is so far above Internet Explorer. Continue reading Firefox has overtaken IE on our site

Plesk, Apache, Tomcat and multiple hosts

In addition to having problems with JNDI not working properly, I’ve also been bashing my head against Plesk–that is supposedly “designed to simplify the management and administration of web sites”.

It’s the interaction between Plesk and Tomcat that’s the particular problem and how both of them negotiate dealing with multiple domains (or rather don’t deal with it). Continue reading Plesk, Apache, Tomcat and multiple hosts

Outputting stack traces in a JSP using JSTL

If you’re writing a JSP using the JSTL tag <c:catch var=”myError”> … </c:catch> then I’m sure that you know that the next thing to do is to check after the closing catch tag to see if myError is empty. If not you can output some useful error message having successfully caught any exception. However, sometimes it’s useful to actually output the stack trace (when debugging a site for example). It turns out not to be difficult to do this. Simply copy in the following:

<c:if test="${not empty myError}">
<p class="error">An error occured: <c:out value="${myError}"/></p>
<pre>
<c:forEach var="stackTraceElem" items="${myError.stackTrace}">
<c:out value="${stackTraceElem}"/><br/>
</c:forEach>