NOTE: This is outdated information that applies only to Tapestry 4.

The HTML:

<form jwcid="appletForm@Form">
    <applet name="myApplet" code="Applet.class" archive="somejar.jar" width="310" height="335">      
      <span jwcid="@Insert" value="ognl:getAppletParameters()" raw="true"/>
    </applet>
    <input type="submit" jwcid="@Submit" listener="ognl:listeners.save" value="Save" onClick="return getAppletValues()"/>    
    <input jwcid="someData@Hidden" value="ognl:someData"/>  
</form>

<script type="text/javascript">
function getAppletValues() {
   document.appletForm.someData.value = document.myApplet.getSomeData();
   return true;
}

The applet class:

 public String getSomeData() { return s; }
 public void setSomeData(String s) { this.s = s; }

The page java class:

/**
 * Get the applet parameters.
 * @return Applet parameters
 */
 public String getAppletParameters() {
   return "<param name=\"someData\" value=\"" + getSomeData() + "\">";
 }

 public abstract String getSomeData();
 public abstract void setSomeData(String s);

TapestryAndApplets (last edited 2011-01-02 21:11:01 by BobHarner)