I agree with Bear's post. Here is a little more detail on how to go about this.
From your servlet, put a
string representation of the codes array into the HttpServletRequest object - something like this:
String[] codes;
String codesArrayString;
// insert here code to place all the elements of codes into codesArrayString
// in the format: "['xxx', 'yyy', 'zzz']"
request.setAttribute("codesArrayString", codesArrayString);
Then in the jsp, you can retrieve the codes from the HttpServletRequest object and put them in a javascript array something like this:
<SCRIPT type="text/javascript">
var codes = <%=(String) request.getAttribute("codesArrayString") %>;
</SCRIPT>