Tag Archives: Web development

JasperException: Failed to load or instantiate TagExtraInfo

org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class

(I had to shorten the article title to fit!)

I’ve just had a problem when I’ve taken a web application from my local Tomcat 5.5 development server (where it worked fine) and uploaded it onto a public server (also using Tomcat 5.5).

Continue reading JasperException: Failed to load or instantiate TagExtraInfo

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

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>

HTML Testing, Ruby and Selenium

One of the problems with using HTML as the user interface is testing it (in fact testing user interfaces has always been a bit of a problem) so I’m always on the look out for good UI testing tools.

For a while I’ve known about and used Watir which scripts Internet Explorer (and now Firefox with FireWatir though it’s a bit more tricky to set up). Watir allows you to write simple but powerful scripts in Ruby that will instruct IE to load up a page, fill in a form, click a button or whatever and then you can make assertions about what should have happened. It’s not difficult to use and even if you don’t know Ruby, if you know other languages, you can soon pick it up.

Today however I came across Selenium (also on the same OpenQA site). This is neat for two reasons: (1) it’s all written in JavaScript so the same script runs in both IE and Firefox, on the PC or Mac; and (2) it has an IDE (a Firefox extension in fact) which lets you record the tests rather than having to write them yourself (you can then save them away and create test suites; you can also load up tests and single step them, etc.). (There is a Watir recorder on the OpenQA site but it’s only version 0.1 so far. There’s also WET which I haven’t tested, but is a Windows application written in Ruby which wraps around Watir.)

The thing I’m currently looking for though is a test environment where I don’t have to install a large infrastructure and which works easily on both PCs and Macs, supporting both IE and Firefox. Selenium seems to give me exactly that. In fact the project’s customer could probably install it on their PC and be able to run the tests (or even record new tests) which would be great.

Please let me know if you know of other tools that would fit the bill or what your experience is with these tools.

Dragging and dropping table rows in Javascript

Summary: This article tells you how to implement drag and drop for HTML tables in Javascript. You can download the source here and play with the demo here.

Updated: now copes with multiple tables on the same page, non-drag and non-drop rows (such as headers) and embedding form elements. Also see my jQuery plug-in which does much more. Continue reading Dragging and dropping table rows in Javascript

Confirming a URL in Javascript

This is a little tip that I discovered a while ago but which I’m always forgetting, so I thought I’d post it here where I woudn’t lose it! Sometimes you’ll have a link on a web page which actually does something to a database, deletes the current thing for example. In those circumstances you want to have some sort of “Are you sure?” confirmation.

Javascript has a confirm dialog that you can use, but because you can use the return value of a method to determine event bubbling, you can use this really neatly to give optional links as follows:


Click here to go to home page

And of course you can try it yourself: Click here to go to home page.

If you click OK, then the confirm returns true and the link is followed. If you click Cancel, then confirm returns false and the event isn’t bubbled up to the href handler and so the link isn’t followed and you stay on the same page.

Firefox development toolbar

A friend recently pointed me to a useful development toolbar for Firefox. It’s similar to the development toolbar here but does even more stuff.

You can find the toolbar at http://chrispederick.com/work/webdeveloper/.

Definitely worth having if you’re working with Firefox (in fact I often use Firefox for debugging Javascript and the like because it tends to be much more helpful than IE!).

Debugging Javascript in Firefox

I’ve recently been trying to make some of my scripts work with Firefox 1.5 (from IE) and I was looking for some debugging help to set me on the right track. I found this tool which seems to work very well: http://getahead.ltd.uk/ajax/venkman.

It’s an updated version of Venkman fixed to work with Firefox 1.5.

One of the things it helped me find is that whereas in IE if I ask a table cell (TD) for the nextSibling and get the next TD, in Firefox you always seem to get a text node first and then the next TD. Similarly for getting the next and previous rows.