You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2005/10/24 22:00:14 UTC

[Jakarta-tapestry Wiki] Update of "TapestryAndApplets" by gabrielh

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-tapestry Wiki" for change notification.

The following page has been changed by gabrielh:
http://wiki.apache.org/jakarta-tapestry/TapestryAndApplets

New page:
The HTML:
You want to set the hidden input (called document.appletForm.someData.value) with the applet method result of document.myApplet.getSomeData().
You want to pass the data back to the applet using the <param> tag, hence the ognl:getAppletParameters() insert.


{{{
<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() + "\">";
 }

}}}


 

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org