I am attempting to create a struts2 component using freemarker. I created a ftl file with code like this:
<script type="text/javascript" src="${parameters.library?default('')}"></script>
Which is expecting a parameter named library to be passed to the component. If the parameter is absent then it defaults to a blank string.
On my JSP page I am referring to the component like this:
<s:component template="mytemplate.ftl">
<s:param name="library" value="/scripts/mylibrary.js"/>
</s:component>
Unfortunately, the value for the library parameter is not being set. It is always a blank string.
I am using the advice from this tutorial and it seems as if the s:param tag should pass the parameter into the template and make it available. What am I missing here?
Does anyone have some experience building these components that could shed some light?
Thanks.