Note that there are some explanatory texts on larger screens.

plurals
  1. POinvoking an applet function through javascript
    primarykey
    data
    text
    <p>I need to call an applet method through javascript</p> <p>my applet method goes like this</p> <pre><code>public class MD5encryption extends Applet { private static final long serialVersionUID = 1L; public static String doTheEncryption(final String strText) throws NoSuchAlgorithmException, NoSuchProviderException { String strResult = null; /* do the encryption*/ return strResult; } } </code></pre> <p>and my jsp file goes like this</p> <pre><code>&lt;%@ taglib prefix="s" uri="/struts-tags"%&gt; &lt;script src= "http://www.java.com/js/deployJava.js"&gt;&lt;/script&gt; &lt;script&gt; &lt;!-- applet id can be used to get a reference to the applet object --&gt; var attributes = { id:'md5appletId', code:'com.package.encryptionMD5.MD5encryption', width:1, height:1} ; var parameters = {jnlp_href: 'parameters.jnlp'} ; deployJava.runApplet(attributes, parameters, '1.6'); &lt;/script&gt; &lt;div&gt; &lt;div&gt; &lt;s:form action="Login" validate="true"&gt; &lt;s:textfield name="userName" label="User ID" maxlength="10" required="true" onkeypress="return onlyNumbersChars(event)" onchange="showDob(this,true)" /&gt; &lt;s:password name="password" label="Password" required="true" maxlength="14" /&gt; &lt;tr&gt;&lt;td&gt;&lt;div&gt; &lt;input type="submit" value="Login" onclick="encrypt()"/&gt; &lt;a href="LoginLink.html"&gt;Forgot Password?&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/s:form&gt; &lt;/div&gt; &lt;/div&gt; &lt;script language="javascript"&gt; function encrypt(){ var password = document.getElementsByName('password')[0]; var md5OfPass = md5appletId.doTheEncryption(password.value); password.value = md5OfPass; } &lt;/script&gt; </code></pre> <p>I'm also using the jnlp file which is at the same location as of applet</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jnlp spec="1.0+" codebase="" href=""&gt; &lt;applet-desc name="Applet Takes Params" main-class="MD5encryption" width="800" height="50"&gt; &lt;param name="paramStr" value="parameter String"/&gt; &lt;param name="paramInt" value="22"/&gt; &lt;/applet-desc&gt; &lt;/jnlp&gt; </code></pre> <p>Am i missing something here as I'm not able to access the function of the applet</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload