In the previous post we replaced the param
elements in Wicket code. Now we will not put the param
elements in the markup, but add it dynamically in the Wicket code.
We use the following markup in our HTML template:
<applet wicket:id="appletId" code="com.mrhaki.wicket.applet.ApplicationApplet" width="100%" height="100%"/>
And the following Java code in our Page class to set the parameters and values for the applet:
add(new WebMarkupContainer("appletId") { @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag componentTag) { final StringBuilder paramBuilder = new StringBuilder(); paramBuilder.append("<param name=\"param1\" value=\"" + valueParam1 + "\"/>"); replaceComponentTagBody(markupStream, openTag, paramBuilder.toString()); } });
A more generic Wicket component is also possible.