I think <a href="+ response.encodeURL("checkcookie.do") + "> should also work. Reason being / means home of web container context. So first statement was giving error. However second url becomes ./checkcookie.do, and . means current directory.