I'm responsible for porting a web application to Struts2 and the original app had the concept of "enabled", "disabled", or "hidden" for its __web controls__.
In Struts 2, it was relatively easy to mimic this behavior by simply creating freemarker templates to customize those controls that needed this behavior and reverting to template.simple for the rest using a theme.properties file that included the line parent = simple An example In template.company, I might have a file named combobox.ftl with the following.... <#assign template_control="/${parameters.templateDir}/simple/combobox.ftl" /> <#if parameters.state?exists> <#if parameters.state == "enabled"> <#include template_control /> <#elseif parameters.state == "disabled"> <#assign parameters = parameters + {"disabled":true} /> <#include template_control /> </#if> <#else> <#include template_control /> </#if> Then if I write the struts tag as follows... <s:combobox blah blah blah> <s:param name="state" value="ui.control_name.state" /> </s:combobox> Where if ui.control_name.state returns "disabled", disable the control, or "hidden" don't include the control at all in the final rendered output. This works for all the controls I need except for the anchor tag. It has both a.ftl and a-close.ftl. When I try to do the same with a.ftl using the following... <s:a blah blah blah> <s:param name="state" value="ui.control_name.state" /> </s:a> The variable parameters.state is not available to a.ftl, but only to a-close.ftl, which is a little too late. I've tried lumping everything together in a-close.ftl like the following... <#assign template_control1="/${parameters.templateDir}/simple/a.ftl" /> <#assign template_control2="/${parameters.templateDir}/simple/a-close.ftl" /> <#if parameters.state?exists> <#if parameters.state == "enabled"> <#include template_control1 /> <#include template_control2 /> <#elseif parameters.state == "disabled"> <#assign parameters = parameters + {"href":""} /> <#include template_control1 /> <#include template_control2 /> </#if> <#else> <#include template_control1 /> <#include template_control2 /> </#if> But this doesn't work since the contents of <s:a> (whether they be strings or other html tags) are render after the a.ftl is rendered, putting the contents of <s:a> just before the rendered <a> tag. My question.. is there a way I can pass in arbitrary parameters that a.ftl can see and use to direct the creating of anchor tag? Filipe Ps: Sorry for the lengthy post... I hope I was clear.