I have a big problem passing a String Variable to a javascript function that creates an applet.
In my Java class i'm passing the variable "endpoint" throught the request
ActionContext.getActionContext().getRequest().setAttribute("endpoint",endpoint);
But I'm unable to recover it in the jsp page. I have tried with several html and struts elements but I can't get it in the js function. The code in my js function (included in the jsp) for recover the variable is:
var endpoint = document.getElementById('endpoint');
Hope that you could lend me a hand. Thank you very much in advance.
Edit: The code of the js function is:
function createApplet(){
var content = '<APPLET id="applet" '+
'code="com.usr.local.AppletFiles.class" '+ 'archive="applet/wsdl4j.jar,applet/xercesImpl.jar,applet/log4j.jar,applet/commons-logging.jar,applet/axis-ant.jar,applet/axis-schema.jar,applet/commons-discovery.jar,applet/jaxrpc.jar,applet/axis.jar,applet/saaj.jar,applet/serializer.jar,applet/xalan.jar,applet/xml-apis.jar,applet/JarApplet.jar">'+
' width="0" height="0" mayscript="true" >';
var tableApplet = document.getElementById('tableApplet');
var endpoint = document.getElementById('endpoint');
alert('Endpoint: '+ endpoint);
var param= '';
for(i=0;i<tableApplet .rows.length;i++){
content += '<PARAM NAME="'+tableApplet .rows[i].cells[0].innerHTML+'" VALUE="'+tableApplet .rows[i].cells[1].innerHTML+'">';
param+= tableApplet .rows[i].cells[0].innerHTML+'#';
}
content += '<param name="parametros" value="'+nombreParametros+'">';
content += '<param name="endpoint" value="'+endpoint+'">';
content +='</APPLET>';
alert('content ' + content );
return content ;
}