This is a clear case for a behavior, and would be simple too.. Like so: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/artwork-parent/artwork/src/main/java/org/wicketstuff/artwork/niftycorners/NiftyCornersBehavior.java
2009/10/10 Paul Huang <[email protected]> > Suppose I write my own wicket component called XYZ that have the following > markup > > <wicket:panel> > <div wicket:id="id_xxx"> > .... > </div> > </wicket:panel> > > How can I inject some js code into this markup so when it's rendered in a > page, I got something like > > <wicket:panel> > <div wicket:id="id_xxx"> > <script type="text/javascript"> > var data=["abc", "efg"]; > document.write(data[0]); > </script> > ..... > <div> > <wicket:panel> > > You may ask why I dont simply keep the js code into the component markup > "XYZ.html", this is because the value of "data" variable will be provided > by > the user and is not fixed. >
