As a dirty hack (no less than JSP deserves) I've defined variables which can be evaluated before being passed to the custom tag:
<%
String onkeypress = "javascript:checkKey("+formName+", '"+listRequestFor+"', "+recPerPage+", "+numPages+");";
String onchange = "javascript:goToPage("+formName+", '"+listRequestFor+"', "+recPerPage+", "+numPages+");";
%>
<myForm:text myBean="${myBean}" inputClass="form-class" inputName="pageNumber"
label="Go to page" size="1"
onkeypress="<%= onkeypress %>"
onkeydown="javascript:numbersOnly();"
onchange="<%= onchange %>" />
This seems to have resolved the issue although it would be nice to understand why/what is going on