Dumped in Coldfusion

Monday, April 23, 2007

Logging in and AJAX

This is an interesting problem. You have parts of a site that users can see without being logged in. Some of the actions on these pages are AJAX requests that do require the user to be logged in.

Does anyone know any cool ways of handling the login, or sites that do this? The normal "redirect to login page that redirects back" option doesn't seem to work for this sort of thing.

Wednesday, April 18, 2007

List lengths

If you have a list in JSP and want to know how long it is then you have to use a function from the JSTL. It isn't 'built-in'.
${fn:length(items)}

which means you need

<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions' %>

elsewhere.

How annoying (and hard to find).

Friday, April 13, 2007

JSP Horror!

I no longer work with Coldfusion on a daily basis, but I have discovered why people use it. JSPs are even worse! It seems that the only way to replace newlines in a string is to assign a newline to a variable, and then use that.


<c:set var="nl" value="
" />
<input type="hidden" name="address" value='${fn:replace(user.address, nl, "&#10;")}'/>


This just seems so flaky.

Is there not a better way? (And I'm not sure that writing a custom tag is a better way).