Chris,

Surrounding it with quotes would mean that I'd have to change all my UI 
templates, as well as my theme templates.   Note how my theme template expects 
a Boolean (not a String) attribute, below:

> < <#if parameters.required?default(false)>
> <  required="true"<#rt/>
> < </#if>


From my perspective this represents a regression from 2.3.1.2, where what I had 
previously worked fine.
It could be due to FreeMarker change, since I also have this in my log:

Caused by: freemarker.template.TemplateModelException: Argument type mismatch; 
can not unwrap argument #1 (class: freemarker.ext.beans.BooleanModel, toString: 
"true") to class java.lang.String
at 
freemarker.ext.beans.SimpleMemberModel.createArgumentTypeMismarchException(SimpleMemberModel.java:175
at 
freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:123)
at 
freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:100)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)



On May 25, 2012, at 1:58 PM, struts....@spamgourmet.com wrote:

> After installing Struts 2.3.4, it appears that dynamic attributes must be 
> strings now?
> 
> I've modified text.ftl in my custom theme like this (diff output):
> 23c23
> < <input type="${parameters.type?default("text")}"<#rt/>
> ---
> > <input type="text"<#rt/>
> 46,54d45
> < <#if parameters.required?default(false)>
> <  required="true"<#rt/>
> < </#if>
> < <#if parameters.autofocus?default(false)>
> <  autofocus="autofocus"<#rt/>
> < </#if>
> < <#if parameters.pattern?? >
> <  pattern="${parameters.pattern?html}"<#rt/>
> < </#if>
> 62c53
> < />
> 
> 
> So that I can use dynamic attributes / HTML5 goodness like this:
> 
> <@s.text type="email" key="user.email" required=true autofocus=true />
> 
> But now Struts 2.3.4 blows up with this message:
> 
> 
> Method public java.lang.String 
> org.apache.struts2.util.StrutsUtil.translateVariables(java.lang.String) threw 
> an exception when invoked on org.apache.struts2.util.StrutsUtil@540948a7
> The problematic instruction:
> ----------
> ==> assignment: value=struts.translateVariables(keyValue)!keyValue [on line 
> 27, column 3 in /themes/simple/dynamic-attributes.ftl]
>  in include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" [on 
> line 52, column 1 in /themes/simple/text.ftl]
>  in include "/${parameters.templateDir}/simple/text.ftl" [on line 25, column 
> 1 in /themes/my-custom-theme/text.ftl]
> ----------
> 
> I made sure to update my simple theme, perhaps I missed some template files?  
> Can anyone help?

Reply via email to