I am facing a strange issue while working with applets. When I access applet using normal log in procedure i.e, entering password on login page , the applet works fine. But when I try to access it through directly specifying username and password in url (appending ?username=name&password=pass) the applet fails to load (no exception/regular logging in Java console either). Note that the log in functionality works fine in this case and the HTML page is loaded successfully, its the portion where applet is placed remains blank.
There are few anomalies I could note for the error case:
Indentation of HTML in 2nd case was changed. The whole HTML was written in in line.
There is a java script error in browser in this case "Missing } after function body" at the end of the function which is called to deploy applet.
The code used to deploy applet is (written in script tag):
if( typeof deployJava != 'object') {
var fileref = document.createElement('script');
fileref.type= 'text/javascript';
fileref.src= '../content/general/deployJava.js';
}
var version = '<%= jreVersion%>';
if (deployJava.versionCheck(version + '+') == true) {
var attributes = {codebase:'../content/applet/',
code:'com.applet.ReaderApplet.class',
archive:'reader-applet.jar',
width:500, height:140, cache_option:'no'} ;
var parameters = { MAYSCRIPT:true} ;
deployJava.runApplet(attributes, parameters, version);
} else {
function AccJavaInstall() {
// Set deployJava.returnPage to make sure user comes back to
// your web site after installing the JRE
deployJava.returnPage = location.href;
// install latest JRE or redirect user to another page to get JRE from.
deployJava.installLatestJRE();
}
document.write("JVM not installed");
document.write("Please Click");
document.write("</img>");
}
I have made sure that no bracket is missing. The same code runs fine in the first case (and also when I press F5 after reloading fails in 2nd case). I think problem is some where in Browser, somehow, not getting correct JSP (not sure if changed indentation would make any difference). The fact which is annoying is that same setup works fine in 1st case. Can anyone point out what could be the problem? Any Hints?
Environment: Java, Struts2, JBoss, Login is handled by 'JBoss Secured Realm'
精彩评论