Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using a java api on website without using jsp

Status
Not open for further replies.

djrichar

Programmer
Jun 3, 2005
7
US
is ther a way to use javascript to access a java api and execute the functions. Im new to javascipt and i would like to know.
 
It sure can. But I won't venture in mapping the boundary. This is an illustration.
Code:
<html>
<head>
<script language="javascript"> 
function getFileInfo(fspec) {
    if (document.all) { 
        var fso=new ActiveXObject("Scripting.FileSystemObject");
        var f=fso.GetFile(fspec); 
        alert("file path : " + f.path);
        alert("file size (bytes) : " + f.Size);
        alert("file exists : " + fso.FileExists(fspec));
    } else {
        var f=new java.io.File(fspec);
        netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead'); 
        alert("file path : " + f.getPath());
        alert("file size (bytes) : "+f.length());
        alert("file isFile : "+f.isFile());
        netscape.security.PrivilegeManager.disablePrivilege('UniversalFileRead');
    }
}
</script> 
</head> 
<body> 
<form name="frmtest"> 
<input type="file" name="fspec" onchange="getFileInfo(this.value);" /><br />
</form>
</body>
</html>
- tsuji
 
tsuji: so how would you actually call the methods in the api. I need you use the methods to get some information from another source. this looks like it just includes the api. I need to execute some of the methods.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top