I have created a GWT widget with root container ID "widgetContainer" and the corresponding compiled file is gwtwidget.nocache.js. I have created a war file of this widget and hosted in a local server localhost:8888/gwtwidget.
I created another jsp application and the index.jsp is as follow: (Integrated GWT module into JSP application)
<html>
<head>
<script type="text/javascript" language="javascript" src="http://localhost:8888/gwtwidget/gwtwidget/gwtwidget.nocache.js?appId=461333815262909&appId=461333815262909&appId=461333815262909&appId=461333815262909"></script>
</head>
<body>
<div id="widgetContainer"></div>
</body>
</html>
I want to retrieve the parameters which are passed through the nocache.js file from the JSP application. For this purpose, I'm using the code
public static native String getParameter( String moduleName, String parameterName ) /*-{
var search = "/" + moduleName + ".nocache.js";
var scripts = $doc.getElementsByTagName( "script" );
for( var i = 0; i < scripts.length; ++i ) {
if( scripts[ i ].src != null && scripts[ i ].src.indexOf( search ) != -1 ) {
var parameters = scripts[ i ].src.match(/\w+=\w+/g);
for( var j = 0; j < parameters.length; ++j ) {
var keyvalue = parameters[ j ].split( "=" );
if( keyvalue.length == 2 && keyvalue[ 0 ] == parameterName ) {
return unescape( keyvalue[ 1 ] );
}
}
}
}
return null;
}-*/;
But unable to get the parameter values into the GWT widget. Can any one please help me in solving this problem?
Thanks in advance.