I want to use a javascript variable as a \'src\' attribute for another tag on the same jsp.
Are you able to use jQuery? If so you could use getScript():
getScript()
http://api.jquery.com/jQuery.getScript/
$.getScript(mylink, function() { // do something using the JS that was loaded. });